Skip to content

fix ghcr

fix ghcr #2

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
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
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker base metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,enable=true,event=branch
- name: Extract Docker alpine metadata
id: alpine
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern=v{{version}}-alpine
type=semver,pattern={{version}}-alpine
type=semver,pattern={{major}}.{{minor}}-alpine
type=semver,pattern={{major}}-alpine
type=ref,enable=true,event=branch,suffix=-alpine
- name: Extract Docker cuda metadata
id: cuda
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern=v{{version}}-cuda
type=semver,pattern={{version}}-cuda
type=semver,pattern={{major}}.{{minor}}-cuda
type=semver,pattern={{major}}-cuda
type=ref,enable=true,event=branch,suffix=-cuda
- 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
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push base Docker image
id: build-and-push-base
uses: docker/build-push-action@v5
with:
platforms: |-
linux/amd64
linux/arm64
context: .
file: init/docker/Dockerfile
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 }}
- name: Build and push CUDA Docker image
id: build-and-push-cuda
uses: docker/build-push-action@v5
with:
platforms: |-
linux/amd64
context: .
file: init/docker/Dockerfile.cuda
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.cuda.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 }}
- name: Build and push Alpine Docker image
id: build-and-push-alpine
uses: docker/build-push-action@v5
with:
platforms: |-
linux/amd64
linux/arm64
context: .
file: init/docker/Dockerfile.alpine
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.alpine.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 }}