Document_retrieval / Dockerfile
abhi2400's picture
Update Dockerfile
c20e6d4 verified
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /code
# ***** THIS IS THE FIX *****
# Set an environment variable to control the Hugging Face cache location
# This ensures we write to a directory we have permission for.
ENV HF_HOME=/code/huggingface_cache
# Install PyMuPDF dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libmupdf-dev \
mupdf-tools \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY ./requirements.txt /code/requirements.txt
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of your application code
COPY ./ /code/
# Tell Docker to run your app using Gunicorn when the container starts
# Replace 'main:app' with 'your_filename:app' if your python file is not named main.py
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "-w", "2", "-b", "0.0.0.0:7860", "main:app"]