feat: add Simplified Chinese (zh-CN) locale, harden runtime image

zh-CN i18n adapted from MIKU-N's fork (github.com/MIKU-N/webspeak3):
new web/src/locales/zh-CN.ts, wired into i18n.tsx's Lang type, system
language detection, language preference persistence, the app.language
option list, and a new document.documentElement.lang sync effect.
App.tsx's language dropdown and the README feature table updated to
match. Missing keys naturally fall back to English via the existing
translations[lang][key] ?? translations.en[key] ?? key chain.

Also adapted from the same fork: the runtime stage's Dockerfile now
strips npm/npx (and npm's cache/package tree) after installing the
gateway's production deps, since nothing in the running container
invokes either afterwards - shrinks the image and drops npm's own CVEs
from the final attack surface. Adds a HEALTHCHECK that curls the
gateway's own port via Node's fetch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-09-01 18:50:01 +02:00
1 parent b14292a95d
commit 563bca2a4b
5 files changed
+529 -5

No files matched your search

+12 -1
View File
@@ -41,7 +41,15 @@ LABEL org.opencontainers.image.title="WebSpeak3"
LABEL org.opencontainers.image.description="Self-hosted web client for TeamSpeak 3 servers"
WORKDIR /app
COPY gateway/package*.json ./
RUN npm ci --omit=dev
# npm/npx are only needed to install the gateway's runtime deps; the
# container never runs either afterwards, so strip them (plus npm's own
# cache/package tree) to shrink the image and drop npm's own CVEs from the
# final attack surface. This does mean `docker exec ... npm ...` won't work
# for ad-hoc debugging in a running container anymore.
RUN npm ci --omit=dev \
&& npm cache clean --force \
&& rm -rf /root/.npm /usr/local/lib/node_modules/npm \
&& rm -f /usr/local/bin/npm /usr/local/bin/npx
COPY --from=gateway-builder /src/gateway/dist ./dist
COPY --from=connector-builder /src/connector/target/release/ts-connector /app/connector-bin/ts-connector
COPY --from=web-builder /src/web/dist /app/web/dist
@@ -51,4 +59,7 @@ ENV WEB_DIST=/app/web/dist
ENV CONNECTOR_BIN=/app/connector-bin/ts-connector
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD ["node", "-e", "fetch('http://127.0.0.1:8080/').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"]
CMD ["node", "dist/index.js"]