Container: New GitHub workflow to build and publish containers

This commit is contained in:
Badlop 2022-04-25 11:06:01 +02:00
parent 9c23a7dc3f
commit ea4a365bf5
1 changed files with 69 additions and 0 deletions

69
.github/workflows/container.yml vendored Normal file
View File

@ -0,0 +1,69 @@
name: Container
on:
push:
paths-ignore:
- '.devcontainer/**'
- 'examples/**'
- 'lib/**'
- 'man/**'
- 'priv/**'
- '**.md'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
container:
name: Container
runs-on: ubuntu-20.04
permissions:
packages: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@v1.14.1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get git describe
id: gitdescribe
run: echo "::set-output name=ver::$(git describe --tags)"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }}
org.opencontainers.image.licenses=GPL-2.0
org.opencontainers.image.vendor=ProcessOne
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2.10.0
with:
build-args: |
VERSION=${{ steps.gitdescribe.outputs.ver }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .github/container
labels: ${{ steps.meta.outputs.labels }}
#platforms: linux/amd64,linux/arm64 # arm takes 30 mins to compile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}