Skip to content

feat(TU-10158): build multi-arch images #1

feat(TU-10158): build multi-arch images

feat(TU-10158): build multi-arch images #1

name: Build & push multi-arch image
on:
workflow_call:
secrets:
GITHUB_TOKEN:

Check failure on line 6 in .github/workflows/image-multiarch.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/image-multiarch.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
description: "GitHub token to download dependencies"
required: true
ECR_REGISTRY:
description: "Image repository"
required: true
inputs:
service:
description: "A name to tag the image"
type: string
required: true
build-args:
description: "Build args"
type: "string"
required: false
context:
description: "Build context"
type: string
required: false
default: "."
labels:
description: "Image labels"
type: string
required: false
default: |
com.typeform.service=${{ inputs.service }}
com.typeform.${{ inputs.service }}.version=${{ github.run_id }}
com.typeform.${{ inputs.service }}.git_commit=${{ github.sha }}
jobs:
build:
name: Build and push image
runs-on: [ self-hosted, bear-ephemeral ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker context for Buildx
run: docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: builders
- name: Build and push images
uses: docker/build-push-action@v5
with:
build-args: ${{ inputs.build-args }}
context: ${{ inputs.context }}
labels: ${{ inputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.ECR_REGISTRY }}/${{ inputs.service }}:${{ github.run_id }}
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
- name: Push latest image
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v5
with:
build-args: ${{ inputs.build-args }}
context: ${{ inputs.context }}
labels: ${{ inputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
tags: ${{ secrets.ECR_REGISTRY }}/${{ inputs.service }}:latest