diff --git a/docker/tinyms/0.3.2-jupyter/Dockerfile b/docker/tinyms/0.3.2-jupyter/Dockerfile new file mode 100644 index 00000000..b56eb9ca --- /dev/null +++ b/docker/tinyms/0.3.2-jupyter/Dockerfile @@ -0,0 +1,13 @@ +ARG BASE_CONTAINER=jupyter/scipy-notebook:ubuntu-18.04 +FROM $BASE_CONTAINER + +LABEL MAINTAINER="TinyMS Authors" + +# Set the default jupyter token with "tinyms" +RUN sh -c '/bin/echo -e "tinyms\ntinyms\n" | jupyter notebook password' + +# Install TinyMS cpu whl package +RUN pip install --upgrade -i https://pypi.mirrors.ustc.edu.cn/simple pip && \ + pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple numpy==1.17.5 tinyms==0.3.2 && \ + pip install --upgrade jupyter notebook jupyterhub nbconvert -i https://pypi.mirrors.ustc.edu.cn/simple && \ + fix-permissions "${CONDA_DIR}" diff --git a/docker/tinyms/0.3.2-nginx/Dockerfile b/docker/tinyms/0.3.2-nginx/Dockerfile new file mode 100644 index 00000000..6a55a9bb --- /dev/null +++ b/docker/tinyms/0.3.2-nginx/Dockerfile @@ -0,0 +1,36 @@ +ARG BASE_CONTAINER=swr.cn-south-1.myhuaweicloud.com/mindspore/mindspore-cpu:1.6.0 +FROM $BASE_CONTAINER + +LABEL MAINTAINER="TinyMS Authors" + +# Install base tools +RUN apt-get update + +# Install TinyMS cpu whl package +RUN pip install --upgrade -i https://pypi.mirrors.ustc.edu.cn/simple pip && pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple tinyms==0.3.2 +RUN git clone https://github.com/tinyms-ai/tinyms.git + +# Ready for tinyms web frontend startup +# Install Nginx and opencv dependencies software +RUN apt-get install nginx=1.14.0-0ubuntu1.11 lsof libglib2.0-dev libsm6 libxrender1 libgl1-mesa-glx -y + +# Configure Nginx +RUN sed -i '/include \/etc\/nginx\/sites-enabled\/\*;/a\ + client_max_body_size 200M;\ + client_body_buffer_size 200M;\ + server {\ + listen 80;\ + server_name 127.0.0.1;\ + root /tinyms/tinyms/serving/web;\ + index index.html;\ + location /predict {\ + add_header Access-Control-Allow-Origin *;\ + add_header Access-Control-Allow-Methods "GET,POST,OPTIONS";\ + 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";\ + proxy_pass http://localhost:5000/predict;\ + }\ + }' /etc/nginx/nginx.conf &&\ + /etc/init.d/nginx start + +COPY ./entrypoint.sh /usr/local/bin/ +CMD ["entrypoint.sh"] diff --git a/docker/tinyms/0.3.2-nginx/entrypoint.sh b/docker/tinyms/0.3.2-nginx/entrypoint.sh new file mode 100644 index 00000000..e4027f0d --- /dev/null +++ b/docker/tinyms/0.3.2-nginx/entrypoint.sh @@ -0,0 +1,13 @@ +set -e + +host_addr=$1 + +if [[ -z $host_addr ]]; +then + echo "nothing to be instead". +else + sed -i 's/127.0.0.1/'$host_addr'/' /etc/nginx/nginx.conf +fi +/etc/init.d/nginx reload && /etc/init.d/nginx restart + +python -c "from tinyms.serving import Server; server = Server(); server.start_server()" & diff --git a/docker/tinyms/0.3.2/Dockerfile b/docker/tinyms/0.3.2/Dockerfile new file mode 100644 index 00000000..6ca3e698 --- /dev/null +++ b/docker/tinyms/0.3.2/Dockerfile @@ -0,0 +1,12 @@ +ARG BASE_CONTAINER=swr.cn-south-1.myhuaweicloud.com/mindspore/mindspore-cpu:1.6.0 +FROM $BASE_CONTAINER + +LABEL MAINTAINER="TinyMS Authors" + +# Install base tools +RUN apt-get update +# Install opencv dependencies software +RUN apt-get install libglib2.0-dev libsm6 libxrender1 libgl1-mesa-glx -y + +# Install TinyMS cpu whl package +RUN pip install --upgrade -i https://pypi.mirrors.ustc.edu.cn/simple pip && pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple tinyms==0.3.2