Skip to content

Commit

Permalink
dev: ci: build Docker images
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
cardoe committed Feb 10, 2023
1 parent 0a052c7 commit c9f1497
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit c9f1497

Please sign in to comment.