1+ ARG BASE_CONTAINER=swr.cn-south-1.myhuaweicloud.com/mindspore/mindspore-cpu:1.5.0
2+ FROM $BASE_CONTAINER
3+
4+ LABEL MAINTAINER="TinyMS Authors"
5+
6+ # Install base tools
7+ RUN apt-get update
8+
9+ # Install TinyMS cpu whl package
10+ RUN pip install --no-cache-dir tinyms==0.3.0
11+ RUN git clone https://github.com/tinyms-ai/tinyms.git
12+
13+ # Ready for tinyms web frontend startup
14+ # Install Nginx and opencv dependencies software
15+ RUN apt-get install nginx=1.14.0-0ubuntu1.9 lsof libglib2.0-dev libsm6 libxrender1 -y
16+
17+ # Configure Nginx
18+ RUN sed -i '/include \/ etc\/ nginx\/ sites-enabled\/\* ;/a\
19+ client_max_body_size 200M;\
20+ client_body_buffer_size 200M;\
21+ server {\
22+ listen 80;\
23+ server_name 127.0.0.1;\
24+ root /tinyms/tinyms/serving/web;\
25+ index index.html;\
26+ location /predict {\
27+ add_header Access-Control-Allow-Origin *;\
28+ add_header Access-Control-Allow-Methods "GET,POST,OPTIONS";\
29+ add_header Access-Control-Allow-Headers "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization";\
30+ proxy_pass http://localhost:5000/predict;\
31+ }\
32+ }' /etc/nginx/nginx.conf &&\
33+ /etc/init.d/nginx start
34+
35+ # Ready for tinyms web backend startup
36+ RUN mkdir -p /etc/tinyms/serving && cp /tinyms/tinyms/serving/config/servable.json /etc/tinyms/serving &&\
37+ mkdir /etc/tinyms/serving/lenet5_mnist && cd /etc/tinyms/serving/lenet5_mnist &&\
38+ wget https://tinyms.obs.cn-north-4.myhuaweicloud.com/ckpt_file/lenet5_mnist/lenet5.ckpt &&\
39+ mkdir /etc/tinyms/serving/cyclegan_cityscape && cd /etc/tinyms/serving/cyclegan_cityscape &&\
40+ wget https://tinyms.obs.cn-north-4.myhuaweicloud.com/ckpt_file/cyclegan_cityscape/G_A.ckpt &&\
41+ wget https://tinyms.obs.cn-north-4.myhuaweicloud.com/ckpt_file/cyclegan_cityscape/G_B.ckpt &&\
42+ mkdir /etc/tinyms/serving/ssd300_shanshui && cd /etc/tinyms/serving/ssd300_shanshui &&\
43+ wget https://tinyms.obs.cn-north-4.myhuaweicloud.com/ckpt_file/ssd300_shanshui/ssd300.ckpt
44+
45+ COPY ./entrypoint.sh /usr/local/bin/
46+ CMD ["entrypoint.sh" ]
0 commit comments