shanto268's picture
v4 flagship Space (3 tiers) from registry v2 (earlier contents: 906bc45ae05c)
f76c3bf verified
Raw History Blame
1.11 kB
# Docker variant (agents/embedspeed, scripts/embedspeed/make_docker_space.py): numba cache baked at build time.
FROM python:3.12-slim
RUN useradd -m -u 1000 user
USER user
ENV SYSTEM=spaces HOME=/home/user PATH=/home/user/.local/bin:$PATH NUMBA_CPU_NAME=generic NUMBA_CACHE_DIR=/home/user/app/numba_cache \
GRADIO_SERVER_NAME=0.0.0.0 PORT=7860 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=2 OPENBLAS_NUM_THREADS=2 MKL_NUM_THREADS=2
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt "gradio==6.29.1" && pip freeze > IMAGE_FREEZE.txt
COPY --chown=user . .
# OAuth Spaces (hf_oauth): Gradio builds real login routes only when SYSTEM=spaces (set above: HF does not set it in Docker
# Spaces, but it does pass SPACE_ID and the OAUTH_* variables at run time). At build time those are absent, so warm.py gets
# placeholders for this one step.
RUN SPACE_ID=build/warm OAUTH_CLIENT_ID=warm OAUTH_CLIENT_SECRET=warm OAUTH_SCOPES="openid profile" \
OPENID_PROVIDER_URL=https://huggingface.co TLSQ_NUM_THREADS=2 python warm.py
CMD ["python", "app.py"]