Skip to content

Commit 1172ff4

Browse files
authored
containerize w/ github action to build and push to ghcr (#3)
1 parent c7715ff commit 1172ff4

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
build-and-publish-latest:
2+
on:
3+
push:
4+
branches:
5+
- astria # Running this job only for astria branch
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v2 # Checking out the repo
10+
- uses: actions/setup-go@v4
11+
with:
12+
go-version: "^1.20.x" # The Go version to download (if necessary) and use.
13+
- run: go version
14+
15+
- name: Log in to registry
16+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
17+
18+
# TODO - build for amd64 and arm64?
19+
- name: Build and Publish latest Docker image
20+
uses: TCPShield/[email protected]
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
23+
image-name: ghcr.io/astriaorg/go-ethereum # Provide only Docker image name, tag will be automatically set to latest
24+
# Pass some additional arguments to the docker build command
25+
# FIXME - version needs to be autoincrement, probably from git tags?
26+
custom-args: --build-arg COMMIT=${GITHUB_SHA} --build-arg VERSION=0.1.0 --build-arg BUILDNUM=${GITHUB_RUN_NUMBER}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ FROM alpine:latest
2222
RUN apk add --no-cache ca-certificates
2323
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
2424

25-
EXPOSE 8545 8546 30303 30303/udp
25+
# Astria - add 50051 for GRPC
26+
EXPOSE 8545 8546 30303 30303/udp 50051
2627
ENTRYPOINT ["geth"]
2728

2829
# Add some metadata labels to help programatic image consumption

Dockerfile.alltools

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ FROM alpine:latest
2222
RUN apk add --no-cache ca-certificates
2323
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
2424

25-
EXPOSE 8545 8546 30303 30303/udp
25+
# Astria - add 50051 for GRPC
26+
EXPOSE 8545 8546 30303 30303/udp 50051
2627

2728
# Add some metadata labels to help programatic image consumption
2829
ARG COMMIT=""

grpc/README.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
11
This package provides a gRPC server as an entrypoint to the EVM.
22

3-
Helpful commands (MacOS):
3+
## Build and run from source:
44
```bash
55
# install necessary dependencies
66
brew install leveldb
77

88
# build geth
99
make geth
1010

11-
# TODO - run beacon?
12-
1311
# run geth
14-
./build/bin/geth --goerli --grpc --grpc.addr "[::1]" --grpc.port 50051
12+
./build/bin/geth --goerli --grpc --grpc.addr "0.0.0.0" --grpc.port 50051
13+
```
14+
15+
### Running with remote Docker image:
16+
```bash
17+
docker run --rm \
18+
-p 8545:8545 -p 30303:30303 -p 50051:50051 \
19+
ghcr.io/astriaorg/go-ethereum --goerli \
20+
--grpc --grpc.addr "0.0.0.0" --grpc.port 50051
21+
```
22+
23+
### Local Docker workflow:
24+
```bash
25+
# build local docker image
26+
docker build \
27+
--build-arg COMMIT=$(git rev-parse HEAD) \
28+
--build-arg VERSION=0.1 \
29+
--build-arg BUILDNUM=1 \
30+
--tag ghcr.io/astriaorg/go-ethereum:local .
31+
32+
# run local docker image
33+
docker run --rm \
34+
-p 8545:8545 -p 30303:30303 -p 50051:50051 \
35+
ghcr.io/astriaorg/go-ethereum:local --goerli \
36+
--grpc --grpc.addr "0.0.0.0" --grpc.port 50051
37+
38+
# build and push to remote from local (as opposed to gh action)
39+
docker build \
40+
--build-arg COMMIT=$(git rev-parse HEAD) \
41+
--build-arg VERSION=0.1 \
42+
--build-arg BUILDNUM=1 \
43+
--tag ghcr.io/astriaorg/go-ethereum:latest .
44+
echo $CR_PAT | docker login ghcr.io -u astriaorg --password-stdin
45+
docker push ghcr.io/astriaorg/go-ethereum:latest
1546
```

0 commit comments

Comments
 (0)