veylant/web-public/Dockerfile
2026-03-13 13:16:35 +01:00

40 lines
1.6 KiB
Docker

# ─── Stage 1: Build ──────────────────────────────────────────────────────────
# Build context must be the PROJECT ROOT (not web-public/) so that the shared
# doc pages in web/src/pages/docs/ are accessible during the build.
#
# docker build -f web-public/Dockerfile -t veylant-public .
#
FROM node:20-alpine AS build
WORKDIR /build
# Install dependencies for the public site
COPY web-public/package.json web-public/package-lock.json* ./web-public/
RUN cd web-public && npm ci --prefer-offline
# Copy the source of the public site
COPY web-public/ ./web-public/
# Copy the shared documentation pages from the main web app
# (vite.config resolves @docs → ../web/src/pages/docs)
COPY web/src/pages/docs/ ./web/src/pages/docs/
# Build the production bundle
ARG VITE_DASHBOARD_URL=http://localhost:3000
ARG VITE_PLAYGROUND_URL=http://localhost:8090/playground
ENV VITE_DASHBOARD_URL=$VITE_DASHBOARD_URL
ENV VITE_PLAYGROUND_URL=$VITE_PLAYGROUND_URL
RUN cd web-public && npm run build
# ─── Stage 2: Serve ──────────────────────────────────────────────────────────
FROM nginx:1.27-alpine
COPY --from=build /build/web-public/dist /usr/share/nginx/html
COPY web-public/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost/index.html || exit 1