ProofedMesh/.forgejo/workflows/build-images.yml
CTO (Paperclip) 174a74435a
Some checks failed
build-images / signing-service image (push) Failing after 15s
validate / JSON Schema (ajv) (push) Successful in 20s
validate / Rego (opa fmt + opa test) (push) Successful in 13s
validate / DB (migrate up/down dry-run) (push) Successful in 25s
validate / Go (vet + test) (push) Successful in 1m13s
ci(images): enable BuildKit for signing-service image build
The signing-service Dockerfile ([DEV-609](/DEV/issues/DEV-609))
starts with `# syntax=docker/dockerfile:1.7` and uses
`RUN --mount=type=cache,...` for Go build/module caches. The legacy
Docker builder rejects both; the image-build job has been failing on
main since DEV-609 landed:

    the --mount option requires BuildKit. Refer to
    https://docs.docker.com/go/buildkit/ to learn how to build images
    with BuildKit enabled

Fix: set `DOCKER_BUILDKIT=1` on the job env so the daemon routes the
build through the declared Dockerfile frontend.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-25 20:06:05 +00:00

84 lines
3 KiB
YAML

name: build-images
# Build + push container images for ProofedMesh services on every push to
# main. PRs run the build to catch Dockerfile breakage but do not push.
#
# The repository is sha256 — same gotchas as validate.yml apply: no
# actions/checkout, clone manually from a trixie/alpine container with
# git ≥ 2.42.
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
signing-service:
name: signing-service image
runs-on: ubuntu-latest
container:
image: debian:trixie-slim
options: --user 0:0
env:
REGISTRY: harbor.basicstack.de
IMAGE_REPO: harbor.basicstack.de/basicstack/signing-service
# The signing-service Dockerfile uses `RUN --mount=type=cache` which
# the legacy Docker builder rejects; enable BuildKit so the daemon
# routes the build through the Dockerfile frontend declared by
# `# syntax=docker/dockerfile:1.7`.
DOCKER_BUILDKIT: "1"
steps:
- name: Install git + buildx client + ca-certs
run: |
set -euo pipefail
apt-get update
# Debian trixie: `docker.io` only installs the daemon; the CLI
# (`/usr/bin/docker`) ships in `docker-cli`, which is a Recommends
# and therefore excluded by `--no-install-recommends`. Add it
# explicitly.
apt-get install -y --no-install-recommends \
git curl ca-certificates docker.io docker-cli
git --version
docker --version
- name: Clone repository (sha256-aware)
run: |
set -euo pipefail
git clone --depth=1 --branch="${GITHUB_REF_NAME}" \
"https://x-access-token:${GITHUB_TOKEN}@forgejo.basicstack.de/${GITHUB_REPOSITORY}.git" \
"${GITHUB_WORKSPACE}"
cd "${GITHUB_WORKSPACE}"
git log -1 --oneline
- name: Resolve tags
id: tags
working-directory: ${{ github.workspace }}
run: |
set -euo pipefail
SHA="$(git rev-parse --short HEAD)"
echo "sha=${SHA}" >> "${GITHUB_OUTPUT}"
echo "image_sha=${IMAGE_REPO}:${SHA}" >> "${GITHUB_OUTPUT}"
echo "image_main=${IMAGE_REPO}:main" >> "${GITHUB_OUTPUT}"
- name: Build image
working-directory: ${{ github.workspace }}
run: |
set -euo pipefail
docker build \
-f services/signing-service/Dockerfile \
-t "${{ steps.tags.outputs.image_sha }}" \
-t "${{ steps.tags.outputs.image_main }}" \
.
- name: Login to Harbor (push jobs only)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
set -eu
echo "${{ secrets.HARBOR_PASSWORD }}" | \
docker login "${REGISTRY}" --username "${{ secrets.HARBOR_USERNAME }}" --password-stdin
- name: Push image (main only)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
set -eu
docker push "${{ steps.tags.outputs.image_sha }}"
docker push "${{ steps.tags.outputs.image_main }}"