Skip to content

lint it up

lint it up #51

Workflow file for this run

name: ghcr-docker-builds
on:
push:
branches:
- unstable
tags:
- v*
permissions:
contents: read
jobs:
docker-ghcr-build-push:
name: Deploy GHCR Containers
runs-on: ubuntu-latest
strategy:
matrix:
docker: [ {name: 'scratch', sfx: ''}, {name: 'cuda', sfx: '-cuda'}, {name: 'alpine', sfx: '-alpine'} ]
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set docker build-args
run: >-
git fetch --force --tags;
source ./settings.sh;
for item in DATE COMMIT VERSION ITERATION BRANCH LICENSE DESC VENDOR MAINT SOURCE_URL; do
eval echo "settings.sh build-arg: ${item}=\$${item}";
eval echo "${item}=\$${item}" >> $GITHUB_ENV;
done
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker ${{ matrix.docker.name }} metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
flavor: latest=false
tags: |
type=semver,priority=1010,pattern=latest,enable=${{ matrix.docker.sfx == '' }}
type=semver,priority=1010,pattern=${{ matrix.docker.name }},enable=${{ matrix.docker.sfx != '' }}
type=semver,priority=1009,pattern={{major}}${{ matrix.docker.sfx }}
type=semver,priority=1008,pattern={{major}}.{{minor}}${{ matrix.docker.sfx }}
type=semver,priority=1007,pattern={{version}}${{ matrix.docker.sfx }}
type=semver,priority=1006,pattern=v{{version}}${{ matrix.docker.sfx }}
type=ref,enable=true,event=branch,suffix=${{ matrix.docker.sfx }}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push ${{ matrix.docker.name }} Docker image
uses: docker/build-push-action@v5
with:
platforms: |-
linux/amd64
linux/arm64
context: .
file: init/docker/Dockerfile.${{ matrix.docker.name }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_DATE=${{ env.DATE }}
COMMIT=${{ env.COMMIT }}
VERSION=${{ env.VERSION }}
ITERATION=${{ env.ITERATION }}
BRANCH=${{ env.BRANCH }}
LICENSE=${{ env.LICENSE }}
DESC=${{ env.DESC }}
VENDOR=${{ env.VENDOR }}
AUTHOR=${{ env.MAINT }}
SOURCE_URL=${{ env.SOURCE_URL }}