Spaces:
Sleeping
Sleeping
# Start with an official Python base image. | |
FROM python:3.11-slim | |
# Set the working directory inside the container. | |
WORKDIR /app | |
# Create a directory for the model cache and set permissions | |
RUN mkdir -p /app/model_cache && chmod 777 /app/model_cache | |
# CRITICAL FIX: Set the Hugging Face cache directory to our writable folder | |
ENV HF_HOME /app/model_cache | |
ENV SENTENCE_TRANSFORMERS_HOME /app/model_cache | |
# Copy the requirements file and install dependencies. | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of your application code. | |
COPY . . | |
# Expose the port the application will run on. | |
EXPOSE 7860 | |
# The command to run your application. | |
CMD ["gunicorn", "-w", "1", "--preload", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:7860", "main:app"] |