FROM node:20-alpine WORKDIR /app # Copy package files first (better Docker caching) COPY package.json ./ # Install all dependencies including devDependencies (needed for build) RUN npm install # Copy all project files COPY . . # Build the React frontend into /dist RUN npm run build # HuggingFace Spaces REQUIRES port 7860 EXPOSE 7860 ENV NODE_ENV=production ENV PORT=7860 # Start server (tsx runs TypeScript directly) CMD ["npx", "tsx", "server.ts"]