FROM python:3.11-slim # --- Hugging Face caches to a writable path inside the container --- ENV HF_HOME=/app/hf_cache \ TRANSFORMERS_CACHE=/app/hf_cache \ HF_DATASETS_CACHE=/app/hf_cache \ HF_HUB_ENABLE_HF_TRANSFER=1 \ PIP_NO_CACHE_DIR=1 \ PYTHONUNBUFFERED=1 # Model id can be overridden at build or runtime ARG MODEL_ID=ethnmcl/checkin-lora-gpt2 ENV MODEL_ID=${MODEL_ID} WORKDIR /app COPY requirements.txt /app/requirements.txt RUN pip install --upgrade pip && pip install -r requirements.txt # Ensure the cache directory exists and is writable (adjust ownership for your base image/user policy) RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache COPY . /app EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]