-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (28 loc) · 1.12 KB
/
Dockerfile
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
FROM ubuntu:18.04 as build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
g++ \
make \
cmake \
curl \
unzip \
libopencv-dev \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
WORKDIR /code
RUN curl https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.9.1%2Bcpu.zip --output libtorch.zip \
&& unzip libtorch.zip -d /assets \
&& rm -rf libtorch.zip
COPY . ./
RUN python3 /code/models/resnet/resnet.py \
&& mv /code/models/resnet/resnet_model_cpu.pth /assets \
&& mv /code/models/resnet/labels.txt /assets
WORKDIR /code/inference-cpp/cnn-classification
RUN ./build.sh && mv predict /assets
FROM ubuntu:18.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
libopencv-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /assets /assets
ENTRYPOINT [ "sh", "-c", "/assets/predict /mnt/$0 /assets/resnet_model_cpu.pth /assets/labels.txt false" ]