File size: 628 Bytes
f3e5f3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c19764
f3e5f3c
0c19764
f3e5f3c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:3.12-slim

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    OMP_NUM_THREADS=2 \
    TORCH_THREADS=2 \
    MODEL_DIR=/home/user/models \
    HF_HUB_DISABLE_TELEMETRY=1
WORKDIR /home/user/app

COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt

# The model repo is public; no token needed to bake it into the image.
COPY --chown=user download_model.py .
RUN python download_model.py /home/user/models

COPY --chown=user . .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]