This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/Dockerfile.frontend
2026-02-19 15:03:20 +00:00

32 lines
1.1 KiB
Docker

# ==========================================
# Chat Switchboard - Frontend Dockerfile
# ==========================================
# Static SPA served by nginx. No API proxy —
# in k8s, the Ingress routes /api/ and /ws to
# the backend service directly.
#
# Build context: repo root
# ==========================================
# Stage 1: Download vendor libs (vendor/ is gitignored)
FROM node:20-alpine AS vendor
WORKDIR /tmp
RUN npm pack marked@16.3.0 dompurify@3.2.4 2>/dev/null && \
mkdir -p /vendor && \
tar xzf marked-*.tgz -C /tmp && cp /tmp/package/lib/marked.umd.js /vendor/marked.min.js && \
rm -rf /tmp/package && \
tar xzf dompurify-*.tgz -C /tmp && cp /tmp/package/dist/purify.min.js /vendor/purify.min.js && \
rm -rf /tmp/package /tmp/*.tgz
# Stage 2: nginx
FROM nginx:1-alpine
COPY nginx.frontend.conf /etc/nginx/conf.d/default.conf
COPY src/ /usr/share/nginx/html/
COPY --from=vendor /vendor/ /usr/share/nginx/html/vendor/
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1