Spaces:
Running
Running
| # Stage 1: Build React/Vite app | |
| FROM node:20-alpine AS build | |
| WORKDIR /app | |
| # Copy package files and install dependencies | |
| COPY package*.json ./ | |
| RUN npm ci | |
| # Copy all source files | |
| COPY . . | |
| # Build the production bundle | |
| RUN npm run build | |
| # Stage 2: Serve using Nginx | |
| FROM nginx:alpine | |
| COPY --from=build /app/dist /usr/share/nginx/html | |
| # Copy the custom Nginx configuration to support SPA routing (Vite React Router) | |
| COPY nginx.conf /etc/nginx/conf.d/default.conf | |
| EXPOSE 7860 | |
| CMD ["nginx", "-g", "daemon off;"] | |