fix: nginx reverse proxy for API/wizard, fix Object.entries null crash
- Replace serve with nginx for proper reverse proxy - /api/* proxied to backend:8000, /wizard/* proxied to wizard:8080 - Eliminates CORS issues (same-origin requests) - Fixes SPA fallback returning 200 for API routes (was hiding backend-down state) - Add null guards on Object.entries for dashboard stats - Remove VITE_API_BASE/VITE_WIZARD_PORT build args (no longer needed)
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -4,16 +4,12 @@ WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
ARG VITE_API_BASE=/api
|
||||
ARG VITE_WIZARD_PORT=18080
|
||||
ENV VITE_API_BASE=$VITE_API_BASE
|
||||
ENV VITE_WIZARD_PORT=$VITE_WIZARD_PORT
|
||||
# API and wizard are proxied via nginx — no VITE_ env vars needed
|
||||
RUN npm run build
|
||||
|
||||
# Production stage — lightweight static server, no nginx
|
||||
FROM node:20-alpine
|
||||
RUN npm install -g serve@14
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/dist ./dist
|
||||
# Production stage — nginx with reverse proxy
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 3000
|
||||
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user