ygauravyy commited on
Commit
25eb4da
·
verified ·
1 Parent(s): 32ac535

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -12
Dockerfile CHANGED
@@ -19,7 +19,6 @@ RUN apt-get update && \
19
 
20
  RUN conda install python=3.8.13 -y
21
 
22
- # Install Python and model dependencies
23
  RUN pip install openmim
24
  RUN pip install torch==2.0.0
25
  RUN mim install mmcv-full==1.7.0
@@ -27,9 +26,7 @@ RUN pip install mmdet==2.27.0
27
  RUN pip install torchserve
28
  RUN pip install mmpose==0.29.0
29
  RUN pip install torchvision==0.15.1
30
- RUN pip install numpy==1.24.4
31
- RUN pip install scikit-image scipy opencv-python requests pyyaml flask glfw PyOpenGL Pillow shapely tqdm
32
- RUN pip install gradio
33
 
34
  # bugfix for xtcocoapi, an mmpose dependency
35
  RUN git clone https://github.com/jin-s13/xtcocoapi.git
@@ -38,7 +35,7 @@ RUN pip install -r requirements.txt
38
  RUN python setup.py install
39
  WORKDIR /
40
 
41
- # prep torchserve (optional)
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/
@@ -48,23 +45,19 @@ COPY config.properties /home/torchserve/config.properties
48
  RUN adduser --disabled-password --gecos '' --uid 1000 appuser
49
 
50
  WORKDIR /app
51
-
52
- # Copy application files, including setup.py and animated_drawings package
53
  COPY setup.py /app/setup.py
54
  COPY animated_drawings /app/animated_drawings
55
  COPY app.py /app/app.py
56
  COPY examples /app/examples
57
-
58
- # Install animated_drawings package in editable mode
59
  RUN pip install -e .
60
 
61
- # Pre-create directories needed by the app and Gradio, and set permissions
62
  RUN mkdir -p uploads_gradio outputs_gradio flagged && \
63
  chown -R appuser:appuser /app
64
 
65
  USER appuser
66
 
67
- # Expose the port for Gradio
68
  EXPOSE 7860
69
 
70
- CMD ["python", "app.py"]
 
 
19
 
20
  RUN conda install python=3.8.13 -y
21
 
 
22
  RUN pip install openmim
23
  RUN pip install torch==2.0.0
24
  RUN mim install mmcv-full==1.7.0
 
26
  RUN pip install torchserve
27
  RUN pip install mmpose==0.29.0
28
  RUN pip install torchvision==0.15.1
29
+ RUN pip install numpy==1.24.4 scikit-image scipy opencv-python requests pyyaml flask glfw PyOpenGL Pillow shapely tqdm
 
 
30
 
31
  # bugfix for xtcocoapi, an mmpose dependency
32
  RUN git clone https://github.com/jin-s13/xtcocoapi.git
 
35
  RUN python setup.py install
36
  WORKDIR /
37
 
38
+ # prep torchserve
39
  RUN mkdir -p /home/torchserve/model-store
40
  RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/torchserve/model-store/
41
  RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/torchserve/model-store/
 
45
  RUN adduser --disabled-password --gecos '' --uid 1000 appuser
46
 
47
  WORKDIR /app
 
 
48
  COPY setup.py /app/setup.py
49
  COPY animated_drawings /app/animated_drawings
50
  COPY app.py /app/app.py
51
  COPY examples /app/examples
 
 
52
  RUN pip install -e .
53
 
54
+ # Pre-create directories and set permissions
55
  RUN mkdir -p uploads_gradio outputs_gradio flagged && \
56
  chown -R appuser:appuser /app
57
 
58
  USER appuser
59
 
 
60
  EXPOSE 7860
61
 
62
+ # Start TorchServe in the background and then run the Gradio app
63
+ CMD sh -c "torchserve --start --ts-config /home/torchserve/config.properties && sleep 10 && python app.py"