| # Use an official Python runtime as a parent image | |
| FROM python:3.9 | |
| # Set the working directory in the container to /app | |
| WORKDIR /app | |
| # Create a directory for Hugging Face cache and set broad permissions | |
| RUN mkdir -p /app/hf_cache | |
| RUN chmod -R 777 /app/hf_cache | |
| # Set environment variable for Hugging Face home | |
| ENV HF_HOME=/app/hf_cache | |
| # Copy the requirements file into the container at /app | |
| COPY ./requirements.txt /app/requirements.txt | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Explicitly copy the jina folder into the container at /app/jina | |
| COPY ./jina /app/jina | |
| # Copy the rest of the application into the container at /app | |
| COPY . /app | |
| # Make port 7860 available to the world outside this container | |
| EXPOSE 7860 | |
| # Define the command to run the app using uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |