# Use the existing base image | |
FROM python:3.9 | |
# Set the working directory | |
WORKDIR /app | |
# Copy requirements file and install dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Set the HF_HOME environment variable to a writable directory | |
ENV HF_HOME=/app/.cache | |
ENV TRANSFORMERS_CACHE=/app/.cache | |
# Create the huggingface directory and set the correct permissions | |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache | |
# Copy the application files | |
COPY . . | |
# Expose the port (if needed) | |
EXPOSE 8000 | |
# Command to run the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "debug"] | |