dev: ci: build Docker images

Uses the existing in-tree Dockerfile to build Docker images when
a release is made and everytime there is a merge to master.
Publishes the images to the GitHub Container Registry as well.
Heavily based on https://docs.docker.com/build/ci/github-actions/examples/
This commit is contained in:
Doug Goldstein 2023-02-09 21:55:46 -06:00 committed by Simon Michael
parent 0641224e81
commit fddc01a3a2

54
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Docker images
on:
push:
branches:
- build-docker
- master
tags:
- '*.*.*'
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=edge
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}