# Use Python as the base image to support heavy AI libraries FROM python:3.11-slim # Install system dependencies and Node.js 20 RUN apt-get update && apt-get install -y curl \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /app # 1. Setup Backend COPY backend/requirements.txt ./backend/ RUN pip install --no-cache-dir -r backend/requirements.txt # 2. Setup Frontend COPY frontend/package*.json ./frontend/ RUN cd frontend && npm install # 3. Copy the rest of the application code COPY . . # 4. Build the Next.js application RUN cd frontend && npm run build # 5. Make the startup script executable RUN chmod +x /app/start.sh # Hugging Face Spaces strictly requires port 7860 EXPOSE 7860 # Run the startup script CMD ["/app/start.sh"]