From 5251bc1d9ce503bd1831733f4600bb789373e4d2 Mon Sep 17 00:00:00 2001 From: pikann22 Date: Mon, 27 Jul 2026 17:04:11 +0000 Subject: [PATCH] feat: add build argument for PACA_VERSION in Dockerfile and CD workflow --- .github/workflows/cd.yml | 2 ++ services/api/Dockerfile | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 29fa4842..fce0947e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -84,6 +84,8 @@ jobs: context: services/api platforms: linux/amd64,linux/arm64 push: true + build-args: | + PACA_VERSION=${{ github.event.release.tag_name }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/services/api/Dockerfile b/services/api/Dockerfile index 38222668..e8f5a1d6 100644 --- a/services/api/Dockerfile +++ b/services/api/Dockerfile @@ -17,6 +17,12 @@ RUN CGO_ENABLED=0 GOOS=linux GOMAXPROCS=1 GOMEMLIMIT=768MiB \ # ── Runtime stage ───────────────────────────────────────────────────────────── FROM alpine:3.21 +# Release tag this image was built from (e.g. "v1.2.3"), baked in by CD via +# --build-arg. Read at startup as PACA_VERSION; defaults to "dev" for local +# builds. See internal/config/load.go and internal/transport/http/handler/version_handler.go. +ARG PACA_VERSION=dev +ENV PACA_VERSION=$PACA_VERSION + RUN apk add --no-cache ca-certificates tzdata su-exec # Create a dedicated non-root user and group for running the API