Skip to content

Commit

Permalink
fix: update image build workflow (#6)
Browse files Browse the repository at this point in the history
* fix: update image build workflow

* fix: update publish docker image
  • Loading branch information
adriantpaez authored Nov 25, 2024
1 parent 473d452 commit d95e46e
Showing 1 changed file with 21 additions and 44 deletions.
65 changes: 21 additions & 44 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,33 @@
name: CI/CD pipeline

env:
DOCKER_REGISTRY: nethermind.jfrog.io

REPO_DEV: angkor-oci-local-dev
REPO_STAGING: angkor-oci-local-staging
REPO_PROD: angkor-oci-local-prod
IMAGE_NAME: eigenlayer-onchain-exporter

name: Publish Docker image

on:
push:
branches: [main]
workflow_dispatch:

permissions:
id-token: write
contents: write

jobs:
build_docker_image:
publish-docker:
name: Publish to Docker Hub
runs-on: ubuntu-latest
outputs:
DOCKER_IMAGE_NAME: ${{ env.IMAGE_NAME }}
DOCKER_IMAGE_TAG: ${{ steps.set_tag.outputs.DOCKER_IMAGE_TAG }}

steps:
- name: Checkout
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Define image tag
id: set_tag
run: |
export DOCKER_IMAGE_TAG=$(git describe --tags)
# This one is to be able to use the image tag in the next steps in this job
echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV
# This one is to be able to use the image tag in the next jobs
echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Setup Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to registry
run: |
docker login ${{ env.DOCKER_REGISTRY }} -u ${{ secrets.ARTIFACTORY_ANGKOR_USERNAME }} -p ${{ secrets.ARTIFACTORY_ANGKOR_TOKEN_DEVELOPER }}
- name: Build and Push
uses: docker/build-push-action@v6
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
context: .
platforms: "linux/amd64"
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.REPO_PROD }}/${{ env.IMAGE_NAME }}:latest
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_ACCESS_TOKEN}}
- name: Determine Docker image tag
id: get_tag
run: |
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "latest")
echo "tag=$TAG" >> $GITHUB_ENV
- name: Build and push image to Docker Hub
run: |
docker buildx build --platform=linux/amd64,linux/arm64 \
-f Dockerfile \
-t "nethermindeth/eigenlayer-oe:${{ env.tag || 'latest' }}" \
. --push

0 comments on commit d95e46e

Please sign in to comment.