-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21f01c5
commit 0a4b187
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()" & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |