# Use Node.js 18 LTS as base image FROM node:18-slim # Set working directory WORKDIR /app # Install system dependencies for TensorFlow.js and Canvas RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ build-essential \ libcairo2-dev \ libpango1.0-dev \ libjpeg-dev \ libgif-dev \ librsvg2-dev \ pkg-config \ && rm -rf /var/lib/apt/lists/* # Copy package files COPY package*.json ./ # Install Node.js dependencies RUN npm install --production # Copy application code COPY . . # Make start script executable RUN chmod +x start.sh # Expose port for Hugging Face Spaces EXPOSE 7860 # Set environment variables ENV NODE_ENV=production ENV PORT=7860 # Start the server CMD ["./start.sh"]