Spaces:
Sleeping
Sleeping
Abhishek
fix: change model download path to models/ to avoid persistent storage mount hiding files
1413ebb | FROM python:3.11-slim AS runtime | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 \ | |
| HOST=0.0.0.0 \ | |
| GRADIO_SERVER_NAME=0.0.0.0 \ | |
| P5_FLUX_MODEL_DIR=models/FLUX.2-klein-base-4B | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends git ca-certificates libcurl4 libgomp1 libstdc++6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| COPY --chown=user requirements.txt ./requirements.txt | |
| RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel \ | |
| && python -m pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user . /app | |
| ARG HF_TOKEN | |
| ENV HF_TOKEN=${HF_TOKEN} | |
| RUN pip install huggingface_hub hf_transfer | |
| USER root | |
| RUN mkdir -p /data && chown -R user:user /data | |
| USER user | |
| RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=false \ | |
| if [ -f /run/secrets/HF_TOKEN ]; then export HF_TOKEN=$(cat /run/secrets/HF_TOKEN); fi && \ | |
| python scripts/download_model.py black-forest-labs/FLUX.2-klein-base-4B models/FLUX.2-klein-base-4B && \ | |
| python scripts/download_model.py openbmb/MiniCPM5-1B models/MiniCPM5-1B | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |