Skip to content

Commit e63ee8c

Browse files
committed
add Dockerfile for TinyMS v0.3.0
1 parent e17c4c8 commit e63ee8c

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG BASE_CONTAINER=jupyter/scipy-notebook:ubuntu-18.04
2+
FROM $BASE_CONTAINER
3+
4+
LABEL MAINTAINER="TinyMS Authors"
5+
6+
# Set the default jupyter token with "tinyms"
7+
RUN sh -c '/bin/echo -e "tinyms\ntinyms\n" | jupyter notebook password'
8+
9+
# Install TinyMS cpu whl package
10+
RUN pip install --no-cache-dir numpy==1.17.5 tinyms==0.3.0 && \
11+
fix-permissions "${CONDA_DIR}"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set -e
2+
3+
host_addr=$1
4+
5+
if [[ -z $host_addr ]];
6+
then
7+
echo "nothing to be instead".
8+
else
9+
sed -i 's/127.0.0.1/'$host_addr'/' /etc/nginx/nginx.conf
10+
fi
11+
/etc/init.d/nginx reload && /etc/init.d/nginx restart
12+
13+
python -c "from tinyms.serving import Server; server = Server(); server.start_server()" &

docker/tinyms/0.3.0/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
# Install opencv dependencies software
9+
RUN apt-get install libglib2.0-dev libsm6 libxrender1 -y
10+
11+
# Install TinyMS cpu whl package
12+
RUN pip install --no-cache-dir tinyms==0.3.0

0 commit comments

Comments
 (0)