diff --git a/.github/workflows/docker_publish.yaml b/.github/workflows/docker_publish.yaml index ed6699a..12f4a60 100644 --- a/.github/workflows/docker_publish.yaml +++ b/.github/workflows/docker_publish.yaml @@ -47,6 +47,9 @@ jobs: with: context: . file: ./Dockerfile + build-args: | + GIT_COMMIT=${{ github.sha }} + GIT_BRANCH=${{ github.ref_name }} push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}-${{ matrix.arch }} platforms: linux/${{ matrix.arch }} diff --git a/Dockerfile b/Dockerfile index 307efa8..7cc43ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,10 +7,6 @@ WORKDIR /app RUN cargo install cargo-chef RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config -LABEL org.opencontainers.image.source=https://github.com/lambdaclass/ethlambda -LABEL org.opencontainers.image.description="ethlambda is a modular Ethereum beam chain client." -LABEL org.opencontainers.image.licenses="MIT" - # Builds a cargo-chef plan FROM chef AS planner COPY --exclude=.git --exclude=target . . @@ -46,6 +42,16 @@ RUN cp /app/target/$BUILD_PROFILE/ethlambda /app/ethlambda FROM ubuntu AS runtime WORKDIR /app +LABEL org.opencontainers.image.source=https://github.com/lambdaclass/ethlambda +LABEL org.opencontainers.image.description="Minimalist, fast and modular implementation of the Lean Ethereum client written in Rust." +LABEL org.opencontainers.image.licenses="MIT" + +ARG GIT_COMMIT=unknown +ARG GIT_BRANCH=unknown + +LABEL org.opencontainers.image.revision=$GIT_COMMIT +LABEL org.opencontainers.image.ref.name=$GIT_BRANCH + # Copy ethlambda over from the build stage COPY --from=builder /app/ethlambda /usr/local/bin diff --git a/Makefile b/Makefile index 5f745cb..0b405d8 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,14 @@ test: ## 🧪 Run all tests, then forkchoice tests with skip-signature-verificat cargo test --workspace cargo test -p ethlambda-blockchain --features skip-signature-verification --test forkchoice_spectests +GIT_COMMIT=$(shell git rev-parse HEAD) +GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) + docker-build: ## 🐳 Build the Docker image - docker build -t ghcr.io/lambdaclass/ethlambda:local . + docker build \ + --build-arg GIT_COMMIT=$(GIT_COMMIT) \ + --build-arg GIT_BRANCH=$(GIT_BRANCH) \ + -t ghcr.io/lambdaclass/ethlambda:local . LEAN_SPEC_COMMIT_HASH:=fbbacbea4545be870e25e3c00a90fc69e019c5bb