File size: 871 Bytes
f2bc4d7
 
a2b5329
f2bc4d7
b5708b6
e12b3b9
f2bc4d7
 
 
 
c46b088
f2bc4d7
 
 
 
 
 
 
 
 
 
a2b5329
c46b088
a2b5329
f2bc4d7
 
a2b5329
 
f2bc4d7
 
 
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.9-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    libgl1 \
    libglib2.0-0 \
    protobuf-compiler \
    git \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=$HOME/app:$HOME/app/models/research:$HOME/app/models/research/slim
WORKDIR $HOME/app

RUN git clone --depth 1 https://github.com/tensorflow/models.git
WORKDIR $HOME/app/models/research
RUN protoc object_detection/protos/*.proto --python_out=.

RUN cp object_detection/packages/tf2/setup.py . && \
    python -m pip install --no-cache-dir .

WORKDIR $HOME/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -U -r requirements.txt

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