ygauravyy commited on
Commit
91eada4
·
verified ·
1 Parent(s): cb8fce9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -5
Dockerfile CHANGED
@@ -2,7 +2,7 @@
2
 
3
  FROM continuumio/miniconda3:24.1.2-0
4
 
5
- # install os dependencies including xauth
6
  RUN mkdir -p /usr/share/man/man1
7
  RUN apt-get update && \
8
  DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
@@ -21,6 +21,7 @@ RUN apt-get update && \
21
 
22
  RUN conda install python=3.8.13 -y
23
 
 
24
  RUN pip install openmim
25
  RUN pip install torch==2.0.0
26
  RUN mim install mmcv-full==1.7.0
@@ -28,9 +29,9 @@ RUN pip install mmdet==2.27.0
28
  RUN pip install torchserve
29
  RUN pip install mmpose==0.29.0
30
  RUN pip install torchvision==0.15.1
31
- RUN pip install numpy==1.24.4 scikit-image scipy opencv-python requests pyyaml flask glfw PyOpenGL Pillow shapely tqdm gradio
32
 
33
- # bugfix for xtcocoapi, an mmpose dependency
34
  RUN git clone https://github.com/jin-s13/xtcocoapi.git
35
  WORKDIR xtcocoapi
36
  RUN pip install -r requirements.txt
@@ -51,6 +52,7 @@ COPY setup.py /app/setup.py
51
  COPY animated_drawings /app/animated_drawings
52
  COPY app.py /app/app.py
53
  COPY examples /app/examples
 
54
  RUN pip install -e .
55
 
56
  # Pre-create directories and set permissions
@@ -61,5 +63,13 @@ USER appuser
61
 
62
  EXPOSE 7860
63
 
64
- # Start TorchServe in background, wait a bit, then run app in xvfb-run
65
- CMD sh -c "torchserve --start --ts-config /home/torchserve/config.properties && sleep 10 && xvfb-run -a python app.py"
 
 
 
 
 
 
 
 
 
2
 
3
  FROM continuumio/miniconda3:24.1.2-0
4
 
5
+ # install os dependencies including xauth for xvfb
6
  RUN mkdir -p /usr/share/man/man1
7
  RUN apt-get update && \
8
  DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
 
21
 
22
  RUN conda install python=3.8.13 -y
23
 
24
+ # Install Python and model dependencies
25
  RUN pip install openmim
26
  RUN pip install torch==2.0.0
27
  RUN mim install mmcv-full==1.7.0
 
29
  RUN pip install torchserve
30
  RUN pip install mmpose==0.29.0
31
  RUN pip install torchvision==0.15.1
32
+ RUN pip install numpy==1.24.4 scikit-image scipy opencv-python requests pyyaml flask glfw PyOpenGL Pillow shapely tqdm
33
 
34
+ # bugfix for xtcocoapi, a dependency of mmpose
35
  RUN git clone https://github.com/jin-s13/xtcocoapi.git
36
  WORKDIR xtcocoapi
37
  RUN pip install -r requirements.txt
 
52
  COPY animated_drawings /app/animated_drawings
53
  COPY app.py /app/app.py
54
  COPY examples /app/examples
55
+
56
  RUN pip install -e .
57
 
58
  # Pre-create directories and set permissions
 
63
 
64
  EXPOSE 7860
65
 
66
+ # Start TorchServe, warm-up models, then run the app.
67
+ # Using xvfb-run for headless rendering.
68
+ CMD sh -c "\
69
+ torchserve --start --ncs --ts-config /home/torchserve/config.properties && \
70
+ sleep 15 && \
71
+ # Warm-up requests with a small test image to load models into memory.
72
+ curl -X POST http://localhost:8080/predictions/drawn_humanoid_detector -F image=@/app/examples/test.png && \
73
+ curl -X POST http://localhost:8080/predictions/drawn_humanoid_pose_estimator -F image=@/app/examples/test.png && \
74
+ xvfb-run -a python app.py \
75
+ "