CoolFace
Apppublic

TCETMILI/PassportExtractor

sourceHugging Faceupdated 7mo agoView on Hugging Face
1likes
Dockerfile.frontend43 linesDownload Raw Back to root
1# Passport Extractor Frontend V2 - React/Vite2# This Dockerfile builds and serves the React frontend3 4# Stage 1: Build the React application5FROM node:18-alpine AS builder6 7WORKDIR /app8 9# Copy package files10COPY frontend_v2/package.json ./11COPY frontend_v2/package-lock.json* ./12 13# Install dependencies14RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi15 16# Copy source code17COPY frontend_v2/ ./18 19# Build arguments for environment variables20ARG VITE_BACKEND_URL=http://localhost:800021ARG VITE_DEPLOYMENT_MODE=DESKTOP22 23# Set environment variables for build24ENV VITE_BACKEND_URL=${VITE_BACKEND_URL}25ENV VITE_DEPLOYMENT_MODE=${VITE_DEPLOYMENT_MODE}26 27# Build the application28RUN npm run build29 30# Stage 2: Serve with nginx31FROM nginx:alpine32 33# Copy custom nginx configuration34COPY frontend_v2/nginx.conf /etc/nginx/conf.d/default.conf35 36# Copy built files from builder stage37COPY --from=builder /app/dist /usr/share/nginx/html38 39# Expose port 8040EXPOSE 8041 42# Start nginx43CMD ["nginx", "-g", "daemon off;"]