# Use Node.js 18 slim image FROM node:18-slim # Set working directory WORKDIR /app # Copy package files first (for better Docker caching) COPY package*.json ./ # Install dependencies RUN npm install # Copy all source code COPY . . # Build TypeScript to JavaScript RUN npm run build # Change ownership to the existing node user (avoids UID conflicts) RUN chown -R node:node /app # Switch to non-root user for security USER node # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Start the game server CMD ["npm", "start"]