2026-02-05 07:36:25 +03:00
|
|
|
# Stage 1: Build
|
|
|
|
|
FROM node:20-alpine AS build-stage
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY package*.json ./
|
2026-10-07 13:07:16 +03:00
|
|
|
RUN npm ci
|
2026-02-05 07:36:25 +03:00
|
|
|
COPY . .
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
# Stage 2: Serve
|
2026-10-07 13:31:53 +03:00
|
|
|
# nginx runs as the unprivileged user "nginx" (uid 101) and listens on 8080 (OVP_UI_PORT); docker-compose publishes
|
|
|
|
|
# it as the host port (OVPMON_HTTP_PORT, default 80). The image entrypoint renders the template into
|
|
|
|
|
# /etc/nginx/conf.d. Behind another proxy or Kubernetes: target port 8080.
|
|
|
|
|
FROM nginxinc/nginx-unprivileged:alpine
|
2026-02-05 07:36:25 +03:00
|
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
2026-02-06 21:14:52 +03:00
|
|
|
COPY default.conf.template /etc/nginx/templates/default.conf.template
|
2026-10-07 13:28:30 +03:00
|
|
|
# Validates OVP_CSP_CONNECT_EXTRA before the template is rendered (20-envsubst-on-templates.sh)
|
|
|
|
|
COPY check-csp-connect-extra.sh /docker-entrypoint.d/15-check-csp-connect-extra.sh
|
2026-10-07 13:31:53 +03:00
|
|
|
# envsubst replaces only variables that are defined, so the defaults must exist.
|
|
|
|
|
# OVP_CSP_CONNECT_EXTRA: extra connect-src origins of the CSP, separated by spaces (empty: same origin only)
|
|
|
|
|
ENV OVP_UI_PORT=8080 \
|
|
|
|
|
OVP_CSP_CONNECT_EXTRA=""
|
|
|
|
|
EXPOSE 8080
|
2026-02-05 07:36:25 +03:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|