2021-11-12 15:14:23 +01:00
|
|
|
name: Create and publish a Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ['main']
|
2021-11-12 15:34:41 +01:00
|
|
|
release:
|
|
|
|
types: [created]
|
2021-11-12 15:14:23 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-11-12 15:18:35 +01:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
2021-11-12 15:14:23 +01:00
|
|
|
- name: Log in to the Container registry
|
2021-11-12 15:18:35 +01:00
|
|
|
uses: docker/login-action@v1
|
2021-11-12 15:14:23 +01:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2021-11-12 15:18:35 +01:00
|
|
|
uses: docker/metadata-action@v3
|
2021-11-12 15:14:23 +01:00
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
2021-11-12 15:18:35 +01:00
|
|
|
uses: docker/build-push-action@v2
|
2021-11-12 15:14:23 +01:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
platforms: linux/amd64,linux/arm64, linux/arm
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|