Build and publish Docker image #33
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 publish Docker image | |
on: | |
release: | |
types: [published] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
name: Build and push Docker image to GitHub Packages | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
ARCH: ["x86_64", "aarch64"] | |
PLAT: ["2014"] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create tag from repo | |
run: | # Uses shell parameter expansion to lowercase | |
echo "TAG=ghcr.io/${GITHUB_REPOSITORY,,}-${{ matrix.PLAT }}_${{ matrix.ARCH }}:latest" >> $GITHUB_ENV | |
- name: Build and push image to GitHub Packages | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
build-args: | | |
ml_version=${{ matrix.PLAT }} | |
ml_arch=${{ matrix.ARCH }} | |
pull: true | |
push: true | |
tags: ${{ env.TAG }} | |