mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
containerize w/ github action to build and push to ghcr (#3)
This commit is contained in:
parent
c7715ff9c8
commit
1172ff42f9
4 changed files with 65 additions and 6 deletions
26
.github/workflows/astria-build-and-publish-image.yml
vendored
Normal file
26
.github/workflows/astria-build-and-publish-image.yml
vendored
Normal file
|
|
@ -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}
|
||||||
|
|
@ -22,7 +22,8 @@ FROM alpine:latest
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
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"]
|
ENTRYPOINT ["geth"]
|
||||||
|
|
||||||
# Add some metadata labels to help programatic image consumption
|
# Add some metadata labels to help programatic image consumption
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ FROM alpine:latest
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
|
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
|
# Add some metadata labels to help programatic image consumption
|
||||||
ARG COMMIT=""
|
ARG COMMIT=""
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
This package provides a gRPC server as an entrypoint to the EVM.
|
This package provides a gRPC server as an entrypoint to the EVM.
|
||||||
|
|
||||||
Helpful commands (MacOS):
|
## Build and run from source:
|
||||||
```bash
|
```bash
|
||||||
# install necessary dependencies
|
# install necessary dependencies
|
||||||
brew install leveldb
|
brew install leveldb
|
||||||
|
|
@ -8,8 +8,39 @@ brew install leveldb
|
||||||
# build geth
|
# build geth
|
||||||
make geth
|
make geth
|
||||||
|
|
||||||
# TODO - run beacon?
|
|
||||||
|
|
||||||
# run geth
|
# 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
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue