Skip to content

Commit

Permalink
Publish docker images to ECR (#53)
Browse files Browse the repository at this point in the history
* 🐳 Publish docker images to ECR

* 🐳 Publish separate docker image for Sepolia

* 🔨 Optimize GHA definition

* 🧹 Final cleanup

* 🔨 Apply & test review feedback

* 🔨 Update GHA definition for production
  • Loading branch information
sameersubudhi authored Dec 10, 2024
1 parent 1b7c67c commit ecd4a49
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 2 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish Docker Images

on:
push:
branches:
- main

env:
DOCKER_BUILD_PLATFORMS: linux/amd64
RETH_FEATURES: jemalloc,asm-keccak,optimism
RETH_BUILD_PROFILE: maxperf

jobs:
docker_prep:
name: Build and push docker image
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
strategy:
matrix:
network: [mainnet, sepolia]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker image
id: docker-image
run: |
if [ "${{ matrix.network }}" = "mainnet" ];
then
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
else
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SEPOLIA }}" >> $GITHUB_OUTPUT
fi
- name: Apply Lisk Sepolia hotfix
id: apply-sepolia-hotfix
if: ${{ matrix.network == 'sepolia' }}
run: git apply ./dockerfile-lisk-sepolia.patch

- name: Build and push image
uses: docker/build-push-action@v6
id: docker-build
with:
context: .
file: reth/Dockerfile
build-args: |
FEATURES=${{ env.RETH_FEATURES }}
RETH_BUILD_PROFILE=${{ env.RETH_BUILD_PROFILE }}
platforms: ${{ env.DOCKER_BUILD_PLATFORMS }}
push: true
tags: |
${{ steps.docker-image.outputs.image }}:latest
${{ steps.docker-image.outputs.image }}:${{ github.sha }}
11 changes: 9 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ on:

jobs:
linux_amd64:
name: Verify image build on linux/amd64 platform
runs-on: ubuntu-latest
strategy:
matrix:
include:
- file: geth/Dockerfile
features:
features:
- file: reth/Dockerfile
features: jemalloc,asm-keccak,optimism
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -29,22 +32,26 @@ jobs:
build-args: |
FEATURES=${{ matrix.features }}
platforms: linux/amd64

linux_arm64:
name: Verify image build on linux/arm64 platform
runs-on: linux-arm64
strategy:
matrix:
include:
- file: geth/Dockerfile
features:
features:
- file: reth/Dockerfile
features: jemalloc,optimism
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the Docker image
uses: docker/build-push-action@v6
with:
Expand Down

0 comments on commit ecd4a49

Please sign in to comment.