trigo / Dockerfile
k-l-lambda's picture
Fix Docker build: use global tsx/tsc directly instead of npm run
863c3aa
raw
history blame
1.17 kB
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) - use global tsx directly
RUN tsx tools/buildJisonParser.ts
# Build frontend (generates dist folder)
RUN cd app && npm run build
# Build backend TypeScript - use global tsc directly
RUN cd backend && tsc
# 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"]