File size: 860 Bytes
56486d0
 
 
 
 
 
 
 
 
d08220e
 
 
 
 
 
 
56486d0
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        libgl1 \
        libglib2.0-0 \
        ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Install Python deps system-wide BEFORE switching user so `hf`, `python`, and
# every other entrypoint land in /usr/local/bin together. sync.py locates `hf`
# via Path(sys.executable).parent / "hf", so they must live in the same dir.
COPY indexing/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
 && pip install --no-cache-dir huggingface_hub

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    HF_HOME=/home/user/.cache/huggingface \
    PYTHONUNBUFFERED=1

WORKDIR $HOME/app

COPY --chown=user . .

EXPOSE 7860
CMD ["python", "backend/server.py", "--host", "0.0.0.0", "--port", "7860"]