-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImageDockerfile
37 lines (27 loc) · 978 Bytes
/
ImageDockerfile
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
FROM pytorch/torchserve:0.2.0-cpu
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-dev \
python3-setuptools \
python3-pip
COPY requirements.txt /home/model-server/
RUN pip install --upgrade pip
RUN pip install -r /home/model-server/requirements.txt
COPY torch_serve/image/handler.py torch_serve/image/config.py /home/model-server/
COPY model/image/fastai_cls_weights.pth /home/model-server/
RUN torch-model-archiver \
--model-name=fastai_model \
--version=1.0 \
--serialized-file=/home/model-server/fastai_cls_weights.pth \
--extra-files=/home/model-server/config.py \
--handler=/home/model-server/handler.py \
--export-path=/home/model-server/model-store/
CMD ["torchserve", \
"--start", \
"--ncs", \
"--model-store", \
"/home/model-server/model-store", \
"--models", \
"fastai_model.mar"]