From 0cf348a34da169cac4441014df11430eee6087d9 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Sun, 26 Apr 2026 07:42:34 +0300 Subject: [PATCH] docker: stabilize web-builder paths and bump builder Go to 1.26 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Dockerfile | 18 +++++++++++------- go.mod | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index b325c673f54e0a488ee52071acb2274fddb46dba..00b23c849d4c82fc64e8f62b5dd4e0c204d472bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/go.mod b/go.mod index 305ac937a3714ecf0f73703533531a33333d4bae..68c12c8d92238687ee44d3bc1d3e85e060c20238 100644 --- a/go.mod +++ b/go.mod @@ -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