File size: 1,106 Bytes
c512e69
 
 
 
4d44ef6
f76c3bf
c512e69
 
f76c3bf
c512e69
4d44ef6
 
 
 
430a968
c512e69
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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"]