Spaces:
Building
Building
Update Dockerfile
Browse files- Dockerfile +13 -5
Dockerfile
CHANGED
@@ -1,23 +1,31 @@
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
5 |
WORKDIR /home/user
|
6 |
|
7 |
ENV PATH="/home/user/.local/bin:$PATH"
|
8 |
|
9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
COPY --chown=user . .
|
|
|
|
|
11 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
12 |
RUN pip install --no-cache-dir -e .
|
13 |
|
14 |
-
# Create model-store directory
|
15 |
RUN mkdir -p /home/user/torchserve/model-store
|
16 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/
|
17 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/
|
18 |
|
19 |
-
# Update config.properties if needed, or copy it here:
|
20 |
-
COPY config.properties /home/user/torchserve/config.properties
|
21 |
-
|
22 |
EXPOSE 7860
|
23 |
CMD ["python", "app.py"]
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
# Create a non-root user
|
4 |
RUN useradd -m -u 1000 user
|
5 |
USER user
|
6 |
WORKDIR /home/user
|
7 |
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
10 |
+
# Install system packages needed for OpenCV
|
11 |
+
USER root
|
12 |
+
RUN apt-get update && \
|
13 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
14 |
+
libgl1-mesa-glx libglib2.0-0 \
|
15 |
+
&& rm -rf /var/lib/apt/lists/*
|
16 |
+
USER user
|
17 |
+
|
18 |
+
# Copy your code
|
19 |
COPY --chown=user . .
|
20 |
+
|
21 |
+
# Install Python dependencies
|
22 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
23 |
RUN pip install --no-cache-dir -e .
|
24 |
|
25 |
+
# Create model-store directory (ensure the path is correct and accessible)
|
26 |
RUN mkdir -p /home/user/torchserve/model-store
|
27 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/
|
28 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/
|
29 |
|
|
|
|
|
|
|
30 |
EXPOSE 7860
|
31 |
CMD ["python", "app.py"]
|