Spaces:
Runtime error
Runtime error
| # Use a suitable Python base image (Updated to bookworm) | |
| FROM python:3.11-slim-bookworm | |
| # Install tini for process supervision | |
| RUN apt-get update && apt-get install -y tini && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Set environment variable for Hugging Face cache directory to a writable location | |
| ENV HF_HOME=/app/.cache/huggingface | |
| # Create the cache directory and set permissions | |
| RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME | |
| # Copy the requirements.txt file into the working directory | |
| COPY requirements.txt . | |
| # Install the Python dependencies | |
| # Also install the SpaCy model directly using pip | |
| RUN pip install --no-cache-dir -r requirements.txt && \ | |
| python -m spacy download en_core_web_sm | |
| # Copy the api.py file into the working directory | |
| COPY api.py . | |
| # Copy any other necessary files (like .env if used for non-secrets) | |
| # If you have a .env file for non-secret configuration, uncomment and copy it | |
| # COPY .env . | |
| # Use tini as the entrypoint and then execute the CMD | |
| ENTRYPOINT ["/usr/bin/tini", "--"] | |
| # Define the command to run the FastAPI application using Uvicorn | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"] |