Publish Docker image #19
Workflow file for this run
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: Publish Docker image | |
on: | |
release: | |
types: [published] | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub for ${{ matrix.platform }} | |
runs-on: | |
group: ${{ matrix.runner_group }} | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
strategy: | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
include: | |
- platform: linux/amd64 | |
runner_group: large_amd64 | |
platform_tag: amd64 | |
- platform: linux/arm64 | |
runner_group: large_arm64 | |
platform_tag: arm64 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: ambarltd | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ambarltd/emulator | |
- name: Build Docker image for ${{ matrix.platform }} | |
id: push | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | |
with: | |
context: ./build/ | |
file: ./build/Dockerfile | |
pull: false | |
push: true | |
platforms: ${{ matrix.platform }} | |
tags: ambarltd/emulator:${{ github.event.release.tag_name }}-${{ matrix.platform_tag }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Push Docker image for ${{ matrix.platform }} | |
run: | | |
docker manifest create ambarltd/emulator:${{ github.event.release.tag_name }} \ | |
--amend ambarltd/emulator:${{ github.event.release.tag_name }}-${{ matrix.platform_tag }} || \ | |
docker manifest create ambarltd/emulator:${{ github.event.release.tag_name }} | |
docker manifest push ambarltd/emulator:${{ github.event.release.tag_name }} | |
docker manifest create ambarltd/emulator:latest \ | |
--amend ambarltd/emulator:${{ github.event.release.tag_name }}-${{ matrix.platform_tag }} || \ | |
docker manifest create ambarltd/emulator:latest | |
docker manifest push ambarltd/emulator:latest |