File size: 1,978 Bytes
6058935
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6c8b6a
6058935
f6c8b6a
6058935
 
 
 
f6c8b6a
 
 
 
739fa83
f6c8b6a
739fa83
b0c8471
739fa83
 
6058935
739fa83
 
6058935
 
 
 
 
 
 
3ac39e8
 
 
004e921
34a7eb6
004e921
3ac39e8
34a7eb6
3a708b9
 
 
b0c8471
3ac39e8
 
 
 
 
 
3a708b9
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
# syntax = docker/dockerfile:1.2

FROM continuumio/miniconda3:24.1.2-0

# install os dependencies
RUN mkdir -p /usr/share/man/man1
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
    ca-certificates \
    curl \
    vim \
    sudo \
    default-jre \
    git \
    gcc \
    g++ \
    build-essential \
    ninja-build \
    && rm -rf /var/lib/apt/lists/*

RUN conda install python=3.8.13 -y

# Set environment variables for MMCV compilation
ENV FORCE_CUDA="0"
ENV MMCV_WITH_OPS=1
ENV MMCV_WITH_CUDA=0
ENV MAX_JOBS=1

# install python dependencies (without MMCV)
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir torch==2.0.0 torchvision==0.15.1 numpy==1.24.4 && \
    pip install --no-cache-dir -r /tmp/requirements.txt

# Install MMCV pre-built wheel for CPU
RUN pip install --no-cache-dir mmcv-full==1.7.0 -f https://download.openmmlab.com/mmcv/dist/cpu/torch2.0.0/index.html

# prep torchserve
RUN mkdir -p /home/torchserve/model-store
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/torchserve/model-store/
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/torchserve/model-store/
COPY config.properties /home/torchserve/config.properties

# Create logs directory with proper permissions
RUN mkdir -p /home/torchserve/logs && \
    chmod -R 777 /home/torchserve/logs

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV TS_LOG_FILE=/home/torchserve/logs/ts_log.log
ENV MODEL_STORE=/home/torchserve/model-store
ENV LOG_LOCATION=/home/torchserve/logs/
ENV METRICS_LOCATION=/home/torchserve/logs/
ENV ENABLE_METRICS_LOGGING=false

# Expose TorchServe ports
EXPOSE 8080
EXPOSE 8081
EXPOSE 8082

# Start TorchServe
CMD ["torchserve", "--start", "--disable-token-auth", "--ts-config", "/home/torchserve/config.properties", "--foreground"]