Spaces:
Running
Running
| FROM node:20 AS builder | |
| WORKDIR /app | |
| COPY frontends/react/package*.json ./frontends/react/ | |
| RUN cd frontends/react && npm install | |
| COPY . . | |
| RUN cd frontends/react && npm run build | |
| # Step 2: Serve it with npx | |
| FROM node:20-slim | |
| WORKDIR /app | |
| # Only copy the built files from the builder | |
| COPY --from=builder /app/frontends/react/dist ./dist | |
| # Install the server tool | |
| RUN npm install -g serve | |
| # Serve the 'dist' folder on the correct Hugging Face port | |
| # -s flag handles Single Page App routing (important for React) | |
| CMD ["serve", "-s", "dist", "-l", "7860"] |