Skip to content

Commit

Permalink
🔨 Optimize GHA definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersubudhi committed Dec 9, 2024
1 parent 7fdb4d3 commit 0d596bb
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ on:
- main
- LISK-1402-Publish-docker-images-to-ECR

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

jobs:
docker:
name: Build and push docker image
docker_prep:
name: Pre-prep for docker image build
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}

outputs:
ecr_registry: ${{ steps.login-ecr.outputs.registry }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -30,15 +38,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

docker_build_mainnet:
needs: docker_prep
name: Build and push mainnet docker image
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}

steps:
- name: Docker image - Mainnet
id: docker-image-mainnet
run: |
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
- name: Docker image - Sepolia
id: docker-image-sepolia
run: |
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY_SEPOLIA }}" >> $GITHUB_OUTPUT
echo "image=${{ job.docker_prep.outputs.ecr_registry }}/${{ secrets.ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
- name: Build and push image for Lisk Mainnet
uses: docker/build-push-action@v6
Expand All @@ -47,14 +57,26 @@ jobs:
context: ./
file: ./reth/Dockerfile
build-args: |
FEATURES=jemalloc,asm-keccak,optimism
RETH_BUILD_PROFILE=maxperf
platforms: linux/amd64
FEATURES=${{ env.RETH_FEATURES }}
RETH_BUILD_PROFILE=${{ env.RETH_BUILD_PROFILE }}
platforms: ${{ env.DOCKER_BUILD_PLATFORMS }}
push: true
tags: |
${{ steps.docker-image-mainnet.outputs.image }}:latest
${{ steps.docker-image-mainnet.outputs.image }}:${{ github.sha }}
docker_build_sepolia:
needs: docker_prep
name: Build and push sepolia docker image
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}

steps:
- name: Docker image - Sepolia
id: docker-image-sepolia
run: |
echo "image=${{ job.docker_prep.outputs.ecr_registry }}/${{ secrets.ECR_REPOSITORY_SEPOLIA }}" >> $GITHUB_OUTPUT
- name: Apply Lisk Sepolia hotfix
id: apply-sepolia-hotfix
run: git apply ./dockerfile-lisk-sepolia.patch
Expand All @@ -66,9 +88,9 @@ jobs:
context: ./
file: ./reth/Dockerfile
build-args: |
FEATURES=jemalloc,asm-keccak,optimism
RETH_BUILD_PROFILE=maxperf
platforms: linux/amd64
FEATURES=${{ env.RETH_FEATURES }}
RETH_BUILD_PROFILE=${{ env.RETH_BUILD_PROFILE }}
platforms: ${{ env.DOCKER_BUILD_PLATFORMS }}
push: true
tags: |
${{ steps.docker-image-sepolia.outputs.image }}:latest
Expand Down

0 comments on commit 0d596bb

Please sign in to comment.