fix(*): failing build #4
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 multi-platform docker image to registry | |
description: action to build and push a multi-platform docker image | |
on: | |
workflow_call: | |
inputs: | |
repository_name: | |
description: Repository name | |
required: true | |
docker_registry: | |
description: Docker registry | |
required: true | |
registry_org: | |
description: Docker registry organisation | |
required: true | |
additional_docker_tag: | |
description: Additional docker tag that can be used to specify stable tags | |
required: false | |
additional_docker_build_args: | |
description: Additional docker build args | |
required: false | |
push: | |
description: Push docker image to registry flag | |
required: true | |
app_version: | |
description: App version | |
required: true | |
HMPPS_QUAYIO_USER: | |
description: Docker registry username | |
required: false | |
HMPPS_QUAYIO_TOKEN: | |
description: Docker registry token | |
required: false | |
runs: | |
using: "composite" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Docker login if Docker registry is quay.io | |
if: ${{ inputs.docker_registry == 'quay.io' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ inputs.docker_registry }} | |
username: ${{ inputs.HMPPS_QUAYIO_USER }} | |
password: ${{ inputs.HMPPS_QUAYIO_TOKEN }} | |
- name: Docker login if Docker registry is ghcr.io | |
if: ${{ inputs.docker_registry == 'ghcr.io' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ inputs.docker_registry }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
# - name: Configure AWS credentials | |
# if: ${{ inputs.docker_registry == 'ecr' }} | |
# uses: aws-actions/configure-aws-credentials@v2 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_MGMT_ECR_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_MGMT_ECR_KEY }} | |
# aws-region: eu-west-2 | |
# - name: Login to Amazon ECR | |
# if: ${{ inputs.docker_registry == 'ecr' }} | |
# uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build Docker images | |
uses: docker/build-push-action@v6 | |
shell: bash | |
run: | | |
echo "Decoding the Certificate": | |
echo "${{ secrets.CERTIFICATE }}" | base64 --decode > WebServiceClientCert.pfx | |
with: | |
cache-from: type=gha | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=gha,mode=max | |
context: . | |
push: ${{ inputs.push }} | |
provenance: false | |
build-args: | | |
"BUILD_NUMBER=${{ inputs.app_version }}" | |
"GIT_REF=${{ github.sha }}" | |
"GIT_BRANCH=${{ github.ref_name }}" | |
"${{ inputs.additional_docker_build_args }}" | |
tags: | | |
${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:latest | |
${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:${{ inputs.app_version }} |