# Frontend Dockerfile for Placebo.mk TanStack React App # Build stage FROM node:20-alpine AS builder WORKDIR /app # Build arguments for environment variables ARG VITE_API_URL ARG VITE_CMS_URL # Set environment variables for build ENV VITE_API_URL=$VITE_API_URL ENV VITE_CMS_URL=$VITE_CMS_URL # Copy package files COPY package*.json ./ COPY package-lock.json* ./ # Install dependencies RUN npm ci # Copy source code COPY . . # Build application RUN npm run build # Production stage FROM nginx:alpine # Copy built application from builder stage COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/nginx.conf # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1 # Expose port EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]