~bigbes/lethe

0cf348a34da169cac4441014df11430eee6087d9 — Eugene Blikh a month ago 4ef7a02
docker: stabilize web-builder paths and bump builder Go to 1.26

Two related Dockerfile correctness fixes uncovered while validating the
review pass:

1. The web-builder stage used WORKDIR /web with vite's relative
   outDir ../internal/server/web/dist resolving to /internal/server/web/dist
   at the container root — working only by relative-path coincidence.
   Mirror the host repo layout inside /src so the path is /src/internal/server/web/dist
   in both stages, making the COPY --from explicit and stable against any
   future WORKDIR or outDir change.

2. golang:1.25-alpine no longer compiles the codebase: the auxilia/culpa
   dep uses errors.AsType which is in 1.26+. Bump the builder image to
   golang:1.26-alpine and the go.mod directive from 1.25.0 to 1.26.0
   so they agree on the actual minimum.

Verified: docker build (full multi-stage) green; produced binary runs.
2 files changed, 12 insertions(+), 8 deletions(-)

M Dockerfile
M go.mod
M Dockerfile => Dockerfile +11 -7
@@ 2,20 2,24 @@

FROM node:20-alpine AS web-builder

WORKDIR /web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
# Mirror the host repo layout inside /src so vite's relative
# `outDir: '../internal/server/web/dist'` resolves to a stable, explicit
# path (/src/internal/server/web/dist) — not to a path that "happens to
# land at the container root" because of WORKDIR.
WORKDIR /src
COPY web/package.json web/package-lock.json web/
RUN cd web && npm ci
COPY web/ web/
RUN cd web && npm run build

FROM golang:1.25-alpine AS builder
FROM golang:1.26-alpine AS builder

WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download

COPY . .
COPY --from=web-builder /internal/server/web/dist /src/internal/server/web/dist
COPY --from=web-builder /src/internal/server/web/dist /src/internal/server/web/dist
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/lethe ./cmd/lethe

FROM gcr.io/distroless/static-debian12:nonroot

M go.mod => go.mod +1 -1
@@ 1,6 1,6 @@
module sourcecraft.dev/bigbes/lethe

go 1.25.0
go 1.26.0

require (
	github.com/coreos/go-oidc/v3 v3.18.0