# Use an official Python runtime as a parent image FROM python:3.9-slim # --- ADD THIS LINE --- # Set the Hugging Face cache directory to a writable location. # This prevents permission errors when the model is downloaded. ENV HF_HOME /tmp # Set the working directory in the container WORKDIR /code # Copy the requirements file into the container COPY requirements.txt . # Install the Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Pre-download the NLTK 'punkt' tokenizer during the build process RUN python -m nltk.downloader punkt # Copy your application code into the container COPY . . # Tell Docker that the container listens on port 7860 EXPOSE 7860 # The command to run your app when the container starts CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]