# Use Python 3.9 slim image FROM python:3.9-slim # Set working directory WORKDIR /app # Install system dependencies including Node.js RUN apt-get update && apt-get install -y \ git \ curl \ gnupg \ && rm -rf /var/lib/apt/lists/* # Install Node.js 18.x RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs && \ rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy package.json and install Node.js dependencies COPY package.json package-lock.json* ./ RUN npm install # Copy all application files COPY . . # Download AI models during Docker build RUN node download_models.js # Ensure models directory exists with proper permissions RUN mkdir -p models && chmod -R 755 models # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Run the application CMD ["python", "app.py"]