2025-10-12 18:23:13 +05:30
|
|
|
# Build stage
|
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
RUN npm ci
|
|
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
# Build without type checking (vite build only)
|
2025-10-20 01:42:50 -07:00
|
|
|
# Pass SIMPLE_MODE environment variable if provided
|
|
|
|
|
ARG SIMPLE_MODE=false
|
|
|
|
|
ENV SIMPLE_MODE=$SIMPLE_MODE
|
2025-10-12 18:23:13 +05:30
|
|
|
RUN npm run build -- --mode production
|
|
|
|
|
|
|
|
|
|
# Production stage
|
2025-10-23 19:42:34 -07:00
|
|
|
FROM nginxinc/nginx-unprivileged:1.29-alpine
|
2025-10-22 19:10:33 -07:00
|
|
|
|
2025-10-23 19:42:34 -07:00
|
|
|
# Copy files as root first, then change ownership
|
2025-10-12 18:23:13 +05:30
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
|
2025-10-23 19:42:34 -07:00
|
|
|
# Change ownership while still root, then switch to nginx user
|
|
|
|
|
USER root
|
|
|
|
|
RUN mkdir -p /etc/nginx/tmp && \
|
|
|
|
|
chown -R nginx:nginx /usr/share/nginx/html /etc/nginx/tmp
|
|
|
|
|
USER nginx
|
2025-10-12 18:23:13 +05:30
|
|
|
|
2025-10-23 19:42:34 -07:00
|
|
|
EXPOSE 8080
|
2025-10-22 19:10:33 -07:00
|
|
|
|
2025-10-23 19:42:34 -07:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|