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

2
.gitignore vendored
View File

@@ -22,6 +22,8 @@ config.json
settings.json
*.db
# go.sum is intentionally committed once populated by go mod tidy
# OS
.DS_Store
Thumbs.db

0
backend/go.sum Normal file
View File

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