From 3505430e575be1185edb4c607172caa32f0c5e29 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sat, 9 May 2026 23:30:54 +0200 Subject: [PATCH] fix(docker): include web/translation in frontend and final stages The Vite SPA reads locale JSON via a glob that resolves to /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. --- Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31dcee4f..717ec0af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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