Spaces:
Sleeping
Sleeping
| # Use the official Python 3.10 slim image | |
| FROM python:3.10-slim | |
| # Set proper timezone or environment parameters if needed | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 | |
| # Set the working directory directly to /app | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the current directory contents into the container at /app | |
| COPY . . | |
| # Ensure the instance and uploads folder exist and have given permissions | |
| RUN mkdir -p uploads instance \ | |
| && chmod -R 777 uploads instance \ | |
| && chmod -R 777 /app | |
| # Expose the standard Hugging Face Spaces port | |
| EXPOSE 7860 | |
| # Set the entrypoint to run the database setup and then launch gunicorn | |
| CMD python -c "from server import app, db; app.app_context().push(); db.create_all()" && gunicorn --bind 0.0.0.0:$PORT --workers 2 --threads 4 --timeout 120 server:app | |