# Frontend Dockerfile (Coolify Optimized) FROM node:20-alpine AS builder WORKDIR /app # Build arguments for environment variables ARG VITE_MS_CLIENT_ID ARG VITE_GOOGLE_CLIENT_ID ARG VITE_API_URL # Set as environment variables for build ENV VITE_MS_CLIENT_ID=$VITE_MS_CLIENT_ID ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID ENV VITE_API_URL=$VITE_API_URL # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci # Copy source code COPY . . # Build the app RUN npm run build # Production stage FROM nginx:alpine # Install wget for healthcheck RUN apk add --no-cache wget # Copy built assets COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD wget -q --spider http://localhost:80 || exit 1 CMD ["nginx", "-g", "daemon off;"]