Skip to content

Build and Push Docker Image #3

Build and Push Docker Image

Build and Push Docker Image #3

name: Build and Push Docker Image
on:
workflow_dispatch:
inputs:
shardeum_branch:
description: 'Shardeum repository branch'
required: true
default: 'itn4-1.16.3'
relayer_collector_branch:
description: 'Relayer collector repository branch'
required: true
default: 'itn4'
json_rpc_server_branch:
description: 'JSON RPC server repository branch'
required: true
default: 'itn4'
image_tag:
description: 'Docker image tag'
required: true
default: 'itn4-1.16.3'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 120 # Set 2 hour timeout
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Docker Build Cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
SHARDEUM_BRANCH=${{ inputs.shardeum_branch }}
RELAYER_COLLECTOR_BRANCH=${{ inputs.relayer_collector_branch }}
JSON_RPC_SERVER_BRANCH=${{ inputs.json_rpc_server_branch }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.image_tag }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
outputs: type=docker
build-contexts: |
app=.
provenance: false
no-cache: false
pull: true
progress: plain