FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies if needed RUN apt-get update && apt-get install -y \ gcc \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY . . # Expose port (Hugging Face Spaces will set the PORT environment variable) EXPOSE 5000 # Set environment variables (these will be configured in Hugging Face Spaces) ENV FLASK_APP=api.py ENV FLASK_RUN_HOST=0.0.0.0 ENV FLASK_ENV=production # Run the application using the port specified by Hugging Face Spaces CMD ["python", "-c", "from api import app; import os; app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)), debug=False)"]