1
0

Add container build and publish to ghcr.io

This commit is contained in:
Tony Grosinger 2022-07-23 08:50:48 -07:00
parent ea6e328bfb
commit 55a85c51ea

49
.github/workflows/docker-publish.yaml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Docker
on:
push:
tags: ["*.*.*"]
env:
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Retrieve tag name
id: tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
tags: ${{ steps.tag.outputs.TAG }}
platforms: linux/amd64,linux/arm64
push: true
labels: ${{ steps.meta.outputs.labels }}