Spaces:
Sleeping
Sleeping
updated dockerfile and protobuf installation
Browse files- Dockerfile +5 -14
Dockerfile
CHANGED
|
@@ -1,40 +1,31 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
| 6 |
-
python3-dev \
|
| 7 |
libgl1 \
|
| 8 |
-
libglx-mesa0 \
|
| 9 |
libglib2.0-0 \
|
| 10 |
protobuf-compiler \
|
| 11 |
git \
|
| 12 |
-
wget \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Set up a new user
|
| 16 |
RUN useradd -m -u 1000 user
|
| 17 |
USER user
|
| 18 |
ENV HOME=/home/user \
|
| 19 |
PATH=/home/user/.local/bin:$PATH \
|
| 20 |
PYTHONPATH=$HOME/app:$HOME/app/models/research:$HOME/app/models/research/slim
|
| 21 |
-
|
| 22 |
WORKDIR $HOME/app
|
| 23 |
|
| 24 |
-
# Install Python dependencies
|
| 25 |
-
COPY --chown=user requirements.txt .
|
| 26 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 27 |
-
|
| 28 |
-
# Clone and install TensorFlow Object Detection API
|
| 29 |
RUN git clone --depth 1 https://github.com/tensorflow/models.git
|
| 30 |
WORKDIR $HOME/app/models/research
|
| 31 |
RUN protoc object_detection/protos/*.proto --python_out=.
|
|
|
|
| 32 |
RUN cp object_detection/packages/tf2/setup.py . && \
|
| 33 |
-
python -m pip install --
|
| 34 |
|
| 35 |
WORKDIR $HOME/app
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
# Copy the rest of the application
|
| 38 |
COPY --chown=user . .
|
| 39 |
-
|
| 40 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
|
|
|
| 6 |
libgl1 \
|
|
|
|
| 7 |
libglib2.0-0 \
|
| 8 |
protobuf-compiler \
|
| 9 |
git \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
RUN useradd -m -u 1000 user
|
| 13 |
USER user
|
| 14 |
ENV HOME=/home/user \
|
| 15 |
PATH=/home/user/.local/bin:$PATH \
|
| 16 |
PYTHONPATH=$HOME/app:$HOME/app/models/research:$HOME/app/models/research/slim
|
|
|
|
| 17 |
WORKDIR $HOME/app
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN git clone --depth 1 https://github.com/tensorflow/models.git
|
| 20 |
WORKDIR $HOME/app/models/research
|
| 21 |
RUN protoc object_detection/protos/*.proto --python_out=.
|
| 22 |
+
|
| 23 |
RUN cp object_detection/packages/tf2/setup.py . && \
|
| 24 |
+
python -m pip install --no-cache-dir .
|
| 25 |
|
| 26 |
WORKDIR $HOME/app
|
| 27 |
+
COPY --chown=user requirements.txt .
|
| 28 |
+
RUN pip install --no-cache-dir -U -r requirements.txt
|
| 29 |
|
|
|
|
| 30 |
COPY --chown=user . .
|
|
|
|
| 31 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|