Spaces:
Sleeping
Sleeping
| # Dockerfile | |
| # This file tells Hugging Face Spaces how to build and run the Flask application. | |
| # 1. Start with a standard Python 3.9 base image. | |
| FROM python:3.9-slim | |
| # 2. Set the working directory inside the container. | |
| WORKDIR /code | |
| # 3. Set environment variables. | |
| # This prevents the /.cache permission error. | |
| ENV HF_HOME="/tmp/.cache/huggingface" | |
| # This explicitly tells Flask which file contains the application. | |
| ENV FLASK_APP=app.py | |
| # 4. Copy the requirements file into the working directory. | |
| COPY ./requirements.txt /code/requirements.txt | |
| # 5. Install the Python dependencies specified in the requirements file. | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # 6. Copy the rest of your application's code (e.g., app.py) into the working directory. | |
| COPY ./ /code/ | |
| # 7. Expose the port that the application will run on. | |
| EXPOSE 7860 | |
| # 8. Define the command to run the application using Flask's built-in server. | |
| CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"] | |