43 lines
1.1 KiB
Docker
43 lines
1.1 KiB
Docker
# ==============================================================================
|
|
# BETTING-ANALYTICS FRONTEND - React Dockerfile
|
|
# ==============================================================================
|
|
# Multi-stage build for production-ready React application with Nginx
|
|
# ==============================================================================
|
|
|
|
# Stage 1: Dependencies
|
|
FROM node:20-alpine AS deps
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Stage 2: Builder
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
ARG VITE_API_URL
|
|
ARG VITE_WS_URL
|
|
|
|
ENV VITE_API_URL=${VITE_API_URL}
|
|
ENV VITE_WS_URL=${VITE_WS_URL}
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 3: Production with Nginx
|
|
FROM nginx:alpine AS runner
|
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:80/health || exit 1
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|