trading/docker/Dockerfile.dashboard
Viktor Barzin 9f86aaf540
add K8s nginx config and parameterize Dockerfile.dashboard
Create nginx-k8s.conf that proxies to localhost:8000 instead of
api-gateway:8000 for K8s pods where both containers share a network
namespace. Update Dockerfile.dashboard to accept a NGINX_CONF build arg
(defaults to docker/nginx.conf for docker-compose compatibility).
2026-02-23 22:27:52 +00:00

35 lines
1,021 B
Text

# Multi-stage Dockerfile for the React dashboard.
# Stage 1: build the Vite/React app
# Stage 2: serve via nginx
# ---------------------------------------------------------------------------
# Stage 1: Node build
# ---------------------------------------------------------------------------
FROM node:20-alpine AS builder
WORKDIR /app
COPY dashboard/package.json dashboard/package-lock.json ./
RUN npm ci
COPY dashboard/ .
RUN npm run build
# ---------------------------------------------------------------------------
# Stage 2: nginx to serve the static build
# ---------------------------------------------------------------------------
FROM nginx:alpine
# Remove default nginx site
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config (override NGINX_CONF for K8s builds)
ARG NGINX_CONF=docker/nginx.conf
COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf
# Copy built assets from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]