Skip to content

Commit

Permalink
containerize w/ github action to build and push to ghcr (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
steezeburger authored Mar 28, 2023
1 parent c7715ff commit 1172ff4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/astria-build-and-publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
build-and-publish-latest:
on:
push:
branches:
- astria # Running this job only for astria branch
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2 # Checking out the repo
- uses: actions/setup-go@v4
with:
go-version: "^1.20.x" # The Go version to download (if necessary) and use.
- run: go version

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

# TODO - build for amd64 and arm64?
- name: Build and Publish latest Docker image
uses: TCPShield/gp-docker-action@1.1.13
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: ghcr.io/astriaorg/go-ethereum # Provide only Docker image name, tag will be automatically set to latest
# Pass some additional arguments to the docker build command
# FIXME - version needs to be autoincrement, probably from git tags?
custom-args: --build-arg COMMIT=${GITHUB_SHA} --build-arg VERSION=0.1.0 --build-arg BUILDNUM=${GITHUB_RUN_NUMBER}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
# Astria - add 50051 for GRPC
EXPOSE 8545 8546 30303 30303/udp 50051
ENTRYPOINT ["geth"]

# Add some metadata labels to help programatic image consumption
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
# Astria - add 50051 for GRPC
EXPOSE 8545 8546 30303 30303/udp 50051

# Add some metadata labels to help programatic image consumption
ARG COMMIT=""
Expand Down
39 changes: 35 additions & 4 deletions grpc/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
This package provides a gRPC server as an entrypoint to the EVM.

Helpful commands (MacOS):
## Build and run from source:
```bash
# install necessary dependencies
brew install leveldb

# build geth
make geth

# TODO - run beacon?

# run geth
./build/bin/geth --goerli --grpc --grpc.addr "[::1]" --grpc.port 50051
./build/bin/geth --goerli --grpc --grpc.addr "0.0.0.0" --grpc.port 50051
```

### Running with remote Docker image:
```bash
docker run --rm \
-p 8545:8545 -p 30303:30303 -p 50051:50051 \
ghcr.io/astriaorg/go-ethereum --goerli \
--grpc --grpc.addr "0.0.0.0" --grpc.port 50051
```

### Local Docker workflow:
```bash
# build local docker image
docker build \
--build-arg COMMIT=$(git rev-parse HEAD) \
--build-arg VERSION=0.1 \
--build-arg BUILDNUM=1 \
--tag ghcr.io/astriaorg/go-ethereum:local .

# run local docker image
docker run --rm \
-p 8545:8545 -p 30303:30303 -p 50051:50051 \
ghcr.io/astriaorg/go-ethereum:local --goerli \
--grpc --grpc.addr "0.0.0.0" --grpc.port 50051

# build and push to remote from local (as opposed to gh action)
docker build \
--build-arg COMMIT=$(git rev-parse HEAD) \
--build-arg VERSION=0.1 \
--build-arg BUILDNUM=1 \
--tag ghcr.io/astriaorg/go-ethereum:latest .
echo $CR_PAT | docker login ghcr.io -u astriaorg --password-stdin
docker push ghcr.io/astriaorg/go-ethereum:latest
```

0 comments on commit 1172ff4

Please sign in to comment.