| FROM python:3.10-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| HF_HUB_ENABLE_HF_TRANSFER=1 \ | |
| GRADIO_ANALYTICS_ENABLED=False \ | |
| HF_HOME="/app/.cache/huggingface" | |
| WORKDIR /app | |
| # Create directories and make them writable | |
| RUN mkdir -p /app/outputs && chmod -R 777 /app/outputs \ | |
| && mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface | |
| COPY requirements.txt . | |
| # Ensure pip is up-to-date and install requirements | |
| RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
| COPY train_text_lora.py . | |
| COPY train_script_wrapper.py . | |
| # The user running the CMD will now have write access to /app/outputs and HF_HOME | |
| CMD ["python", "train_script_wrapper.py"] | |