fix(docker): include web/translation in frontend and final stages

The Vite SPA reads locale JSON via a glob that resolves to
<repo>/web/translation/*.json, but the frontend build stage only
copied frontend/, so the production bundle shipped with no messages
and the Docker panel rendered untranslated keys. Copy the directory
into the frontend stage at the path the glob expects, and into the
final image so the Go disk fallback in locale.loadTranslationsFromDisk
also has somewhere to read from.
This commit is contained in:
MHSanaei 2026-05-09 23:30:54 +02:00
parent f68a14a3ca
commit 3505430e57
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A

View file

@ -1,19 +1,13 @@
# ========================================================
# Stage: Frontend (Vite)
# ========================================================
# web/dist/ is .gitignored and embedded into the Go binary via
# //go:embed all:dist in web/web.go, so the SPA bundle MUST be built
# before the Go compile step. We build it in its own stage so the
# Go builder image doesn't need Node installed.
FROM node:22-alpine AS frontend
WORKDIR /src/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
COPY web/translation /src/web/translation
RUN npm run build
# Vite outDir is set to ../web/dist (see frontend/vite.config.js), so
# the bundle lands at /src/web/dist — that's what we copy into the
# next stage.
# ========================================================
# Stage: Builder
@ -54,6 +48,7 @@ RUN apk add --no-cache --update \
COPY --from=builder /app/build/ /app/
COPY --from=builder /app/DockerEntrypoint.sh /app/
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
COPY --from=builder /app/web/translation /app/web/translation
# Configure fail2ban