Spaces:
Building
Building
Update Dockerfile
Browse files- Dockerfile +18 -11
Dockerfile
CHANGED
@@ -14,11 +14,11 @@ RUN apt-get update && \
|
|
14 |
git \
|
15 |
gcc \
|
16 |
build-essential \
|
|
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
RUN conda install python=3.8.13 -y
|
20 |
|
21 |
-
|
22 |
# install python dependencies
|
23 |
RUN pip install openmim
|
24 |
RUN pip install torch==2.0.0
|
@@ -31,27 +31,34 @@ RUN pip install gradio
|
|
31 |
RUN git clone https://github.com/jin-s13/xtcocoapi.git
|
32 |
WORKDIR xtcocoapi
|
33 |
RUN pip install -r requirements.txt
|
34 |
-
RUN pip install -e .
|
35 |
RUN python setup.py install
|
36 |
WORKDIR /
|
37 |
RUN pip install mmpose==0.29.0
|
38 |
RUN pip install torchvision==0.15.1 # solve torch version problem
|
39 |
-
RUN pip install numpy==1.24.4 #solve numpy version problem
|
40 |
|
41 |
-
# prep torchserve
|
42 |
RUN mkdir -p /home/torchserve/model-store
|
43 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/torchserve/model-store/
|
44 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/torchserve/model-store/
|
45 |
COPY config.properties /home/torchserve/config.properties
|
46 |
|
47 |
-
#
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
51 |
-
COPY app.py /app.py
|
52 |
|
53 |
-
# Expose the port that Gradio will listen on
|
54 |
-
EXPOSE 7860
|
55 |
|
56 |
-
# Set the command to run the Gradio interface
|
57 |
CMD ["python", "app.py"]
|
|
|
14 |
git \
|
15 |
gcc \
|
16 |
build-essential \
|
17 |
+
wget \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
RUN conda install python=3.8.13 -y
|
21 |
|
|
|
22 |
# install python dependencies
|
23 |
RUN pip install openmim
|
24 |
RUN pip install torch==2.0.0
|
|
|
31 |
RUN git clone https://github.com/jin-s13/xtcocoapi.git
|
32 |
WORKDIR xtcocoapi
|
33 |
RUN pip install -r requirements.txt
|
|
|
34 |
RUN python setup.py install
|
35 |
WORKDIR /
|
36 |
RUN pip install mmpose==0.29.0
|
37 |
RUN pip install torchvision==0.15.1 # solve torch version problem
|
38 |
+
RUN pip install numpy==1.24.4 # solve numpy version problem
|
39 |
|
40 |
+
# prep torchserve (optional)
|
41 |
RUN mkdir -p /home/torchserve/model-store
|
42 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/torchserve/model-store/
|
43 |
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/torchserve/model-store/
|
44 |
COPY config.properties /home/torchserve/config.properties
|
45 |
|
46 |
+
# Create a non-root user with UID 1000
|
47 |
+
RUN adduser --disabled-password --gecos '' --uid 1000 appuser
|
48 |
+
|
49 |
+
WORKDIR /app
|
50 |
+
COPY app.py /app
|
51 |
+
# Pre-create directories and adjust permissions
|
52 |
+
RUN mkdir uploads_gradio outputs_gradio && chown appuser:appuser uploads_gradio outputs_gradio
|
53 |
+
|
54 |
+
# If your code references the `examples` directory, copy it and chown as well
|
55 |
+
# Assuming you have an `examples` directory in your local context:
|
56 |
+
# COPY examples /app/examples
|
57 |
+
# RUN chown -R appuser:appuser /app/examples
|
58 |
|
59 |
+
USER appuser
|
|
|
60 |
|
61 |
+
# Expose the port that Gradio will listen on
|
62 |
+
EXPOSE 7860 8080 8081 8082
|
63 |
|
|
|
64 |
CMD ["python", "app.py"]
|