Spaces:
Sleeping
Sleeping
| FROM node:20-slim | |
| # Set noninteractive installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install build dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy entire trigo-web project | |
| COPY trigo-web/ ./ | |
| # Install build tools globally | |
| RUN npm install -g tsx jison typescript | |
| # Install dependencies | |
| # Root: production only (skip onnxruntime-node which requires native compilation) | |
| # App & Backend: all deps needed for build | |
| RUN npm install --omit=dev && \ | |
| cd app && npm install && \ | |
| cd ../backend && npm install && \ | |
| cd .. | |
| # Build jison parsers (required for the game) | |
| RUN npm run build:parsers | |
| # Build frontend (generates dist folder) | |
| RUN cd app && npm run build | |
| # Build backend TypeScript | |
| RUN cd backend && npm run build | |
| # Set environment variables for Hugging Face Spaces | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| ENV NODE_ENV=production | |
| # Expose port 7860 (required by Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Start backend server (which will also serve frontend static files) | |
| CMD ["npm", "run", "start:prod"] | |