fix: Dockerfile no longer requires go.sum to exist before first build

Removed go.sum from the COPY cache layer — go mod download -x creates it
when absent. Added empty backend/go.sum for local tooling (gopls, go build).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 13:17:37 +02:00
parent 8138abad4e
commit 2bc544ccae
3 changed files with 6 additions and 2 deletions

View File

@@ -11,8 +11,10 @@ RUN npm run build
FROM golang:1.22-alpine AS backend-builder
WORKDIR /app/backend
COPY backend/go.mod backend/go.sum ./
RUN go mod download
# Copy go.mod first for layer caching. go.sum is written by go mod download
# when it doesn't exist yet (skeleton project), or verified when it does.
COPY backend/go.mod ./
RUN go mod download -x
COPY backend/ ./
# CGO disabled — pure Go SQLite (modernc.org/sqlite).
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /archivum ./cmd/server