File size: 761 Bytes
af6755f
 
27a01ea
af6755f
cd4fb81
27a01ea
af6755f
888ef7f
27a01ea
888ef7f
 
 
 
 
 
cd4fb81
27a01ea
888ef7f
 
 
af6755f
888ef7f
cd4fb81
764f037
c8a84e6
 
cd4fb81
 
af6755f
cd4fb81
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
30
31
FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PORT=7860

RUN useradd --create-home --uid 1000 user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

COPY --chown=user:user requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt

COPY --chown=user:user . .

USER user

RUN mkdir -p $HOME/app/data && \
    python -m compileall -q app

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860/api/health', timeout=3)"

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--proxy-headers"]