Dockerfile duplicates dependency installs inline instead of running script/bootstrap, and omits -trimpath / -s -w #95
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the audit against the canonical
REPO_POLICIES.md, verified againstmainat61f42e6.1. Inline dependency installs instead of
script/bootstrap. The policy requires:> Dockerfiles install development prerequisites by running
script/bootstraprather than duplicating installs inline; COPYscript/and the dependency manifests (package.json+yarn.lock,go.mod+go.sum, etc.) before running it so the bootstrap layer stays cached until dependencies change.Dockerfile:5(lint stage) runsapk add --no-cache make build-base vips-dev libheif-dev pkgconfig, andDockerfile:30-34(build stage) runsapk add --no-cache build-base vips-dev libheif-dev pkgconfig.script/bootstrapis never invoked. This duplicatesensure_cgo_deps()atscript/bootstrap:107-117, which already has anapkbranch installingpkgconfig,vips-dev,libheif-dev.Two copies of the same dependency list drift independently — a new libvips dependency added to
script/bootstrapfor local development silently does not reach the Docker build, and the failure shows up as a confusing CGO link error in CI rather than as a missing package.2. Missing build flags. The policy's standard Go Dockerfile pattern is:
Dockerfile:49isRUN CGO_ENABLED=1 GOTOOLCHAIN=auto go build -ldflags "-X main.Version=${VERSION}" -o /pixad ./cmd/pixad— no-trimpath, no-s -w.CGO_ENABLED=1is a legitimate, necessary deviation (libvips), so the block is not followed literally and should not be. But-trimpathand-s -whave no such justification: without-trimpaththe binary embeds/src/...build paths, which brushes against the policy's "Internal errors must never leak ... file paths", and-s -wis free binary size.Stated honestly: item 2 comes from a code-block example rather than prose stated as a MUST, so it is a weaker requirement than item 1. Flagging it because the two fixes are one file and one commit.
Definition of done
COPY script/ ./script/plusgo.mod/go.sum, thenRUN script/bootstrapin place of the inlineapk addlines, ordered so the bootstrap layer caches on the manifests.-trimpathand-s -wadded to the build; the binary still reports its version correctly (verify by running--versionor equivalent on the built image, not by inspection).docker build .green end to end, and the lint stage still works — it is the authoritative gate.Coordination
Dockerfileis modified by PR #54 (the lint-stage image pin). Do this after #54 merges to avoid conflicting with a PR that has already passed review.