# Use an official Python runtime as a parent image | |
FROM python:3.9 | |
# Set the working directory in the container | |
WORKDIR /code | |
# Copy the dependencies file to the working directory | |
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's code to the working directory | |
COPY . /code | |
# Create a directory for the Hugging Face cache and set correct permissions | |
RUN mkdir -p /code/huggingface_cache && chmod -R 777 /code/huggingface_cache | |
ENV HF_HOME=/code/huggingface_cache | |
# Run the application | |
CMD ["sh", "-c", "gunicorn -b 0.0.0.0:7860 app:app"] | |