70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
- cron: '0 0 1,7,14,21,28 * *'
|
|
workflow_dispatch: # Allows manual triggering
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
max-parallel: 1
|
|
matrix:
|
|
flavor: [default, python, full, full-python]
|
|
runs-on: docker-builder
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
submodules: true
|
|
|
|
- name: Install cosign
|
|
uses: sigstore/cosign-installer@v3
|
|
- name: Check cosign install
|
|
run: cosign version
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
harbor.pollinger.dev/public/latex-build-container
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.flavor == 'default' }}
|
|
type=raw,value=${{ matrix.flavor }},enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: harbor.pollinger.dev
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
target: ${{ matrix.flavor }}
|
|
push: true
|
|
sbom: true
|
|
provenance: mode=max
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=harbor.pollinger.dev/build-cache/latex-build-container
|
|
cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=harbor.pollinger.dev/build-cache/latex-build-container
|
|
|
|
- name: Sign the published server image
|
|
env:
|
|
TAGS: ${{ steps.meta.outputs.tags }}
|
|
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
|
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |