File size: 2,119 Bytes
95ffafb
 
783f65d
464749e
34b88b6
f3e010b
 
 
464749e
f3e010b
464749e
95ffafb
34b88b6
 
95ffafb
 
 
 
 
 
 
 
 
 
 
34b88b6
 
 
 
f3e010b
95ffafb
 
 
 
 
 
 
 
 
 
99b12b9
95ffafb
 
 
 
 
 
 
 
 
 
f3e010b
464749e
95ffafb
6ad429f
 
 
464749e
7c7cab0
cf576d4
95ffafb
 
 
 
 
 
b68da6c
828c5f0
95ffafb
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# syntax = docker/dockerfile:1.2

FROM python:3.8

# Create a non-root user
RUN useradd -m -u 1000 user
USER user
WORKDIR /home/user

ENV PATH="/home/user/.local/bin:$PATH"

# Install system packages needed for OpenCV and other dependencies
USER root
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
        ca-certificates \
        curl \
        vim \
        sudo \
        default-jre \
        git \
        gcc \
        build-essential \
        libgl1-mesa-glx \
        libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*
USER user

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir openmim
RUN pip install --no-cache-dir torch==2.0.0
RUN mim install mmcv-full==1.7.0
RUN pip install --no-cache-dir mmdet==2.27.0
RUN pip install --no-cache-dir torchserve

# Clone and install xtcocoapi (a dependency for mmpose)
RUN git clone https://github.com/jin-s13/xtcocoapi.git
WORKDIR xtcocoapi
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -e .
WORKDIR /home/user

# Install additional Python packages
RUN pip install --no-cache-dir mmpose==0.29.0
RUN pip install --no-cache-dir torchvision==0.15.1 numpy==1.24.4

# Copy your application code
COPY --chown=user . .

# Install your application's Python dependencies
RUN pip install --no-cache-dir -e .

# Prepare TorchServe model-store and download necessary models
RUN mkdir -p /home/user/torchserve/model-store
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/

# Copy TorchServe configuration files
COPY config.properties /home/config.properties

# Copy the start.sh script
COPY start.sh /home/user/start.sh
RUN chmod +x /home/user/start.sh

# Expose necessary ports
EXPOSE 7860 8080 8081 8082

# Start both TorchServe and Gradio
CMD ["/home/user/start.sh"]