fastsdcpu / Dockerfile
Gaston895's picture
fix: remove build-time model download — HF secrets unavailable at build time
49df561
Raw History Blame Contribute Delete
854 Bytes
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Python deps
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# App source
COPY . .
# ---------------------------------------------------------------------------
# Runtime environment — model is downloaded on first startup using HF_TOKEN
# secret set in Space settings (Spaces secrets are NOT available at build time)
# ---------------------------------------------------------------------------
ENV MODEL_ID=gsstec/LFM2-700M
ENV HF_HOME=/app/model_cache
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV HF_HUB_DISABLE_PROGRESS_BARS=1
# HuggingFace Spaces runs as uid 1000
RUN useradd -m -u 1000 user && chown -R user /app
USER user
EXPOSE 7860
CMD ["python", "app.py"]