Build and Push Containers #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Containers | |
on: | |
workflow_dispatch: | |
inputs: | |
commit_sha: | |
description: "Specific Commit SHA (Required)" | |
required: true | |
release_tag: | |
description: "Release Tag (Optional)" | |
required: false | |
default: "" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: nethermindeth/near-sffl | |
jobs: | |
custom-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: ./indexer/Dockerfile | |
image: indexer | |
- dockerfile: ./relayer/cmd/Dockerfile | |
image: relayer | |
- dockerfile: ./aggregator/cmd/Dockerfile | |
image: aggregator | |
- dockerfile: ./operator/cmd/Dockerfile | |
image: operator | |
- dockerfile: ./plugin/cmd/Dockerfile | |
image: operator-plugin | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.commit_sha }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
driver-opts: >- | |
image=moby/buildkit:master | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Tag Name | |
id: set_tag | |
run: echo "tag=${{ github.event.inputs.release_tag || github.event.inputs.commit_sha }}" >> $GITHUB_OUTPUT | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.image }}:${{ steps.set_tag.outputs.tag }} |