Skip to content

Commit

Permalink
增加supervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
alisen39 committed Jun 14, 2020
1 parent 68674c5 commit 35d9b65
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.7.7-slim

COPY . ./TrWebOCR
RUN sed -i 's#http://deb.debian.org#https://mirrors.163.com#g' /etc/apt/sources.list
RUN apt update && apt install -y libglib2.0-dev libsm6 libxrender1 libxext-dev
RUN apt update && apt install -y libglib2.0-dev libsm6 libxrender1 libxext-dev supervisor

RUN /usr/local/bin/python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -r ./TrWebOCR/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN python ./TrWebOCR/install.py
EXPOSE 8089
CMD ["python"," ./TrWebOCR/backend/main.py"]
CMD ["supervisord","-c","/TrWebOCR/supervisord.conf"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ docker build -t trwebocr:latest .

2. Docker run
```shell script
docker run --name trwebocr -p 8089:8089 -itd trwebocr:latest /bin/bash

docker run -itd -p 8089:8089 --name trwebocr trwebocr:latest
```

这里把容器的8089端口映射到了物理机的8089上,但如果你不喜欢映射,去掉run后面的`-p 8089:8089` 也可以使用docker的IP加`8089`来访问
Expand Down Expand Up @@ -117,6 +116,7 @@ res = requests.post(url=url, data={'img': img_b64})
* 2020年06月14日
优化Dockerfile,解决Build失败报错
Dockerfile需要下载的部分使用国内源,提高build速度
增加supervisor守护python进程

* 2020年06月13日
增加接口调用示例
Expand Down
10 changes: 10 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[supervisord]
nodaemon=true

[program:trwebocr]
autorestart=True ; 程序异常退出后自动重启
autostart=True ; 在 supervisord 启动的时候也自动启动
process_name=trwebocr
command=python ./TrWebOCR/backend/main.py
directory=/
user=root
1 change: 1 addition & 0 deletions updateHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* 2020年06月14日
优化Dockerfile,解决Build失败报错
Dockerfile需要下载的部分使用国内源,提高build速度
增加supervisor守护python进程

* 2020年06月13日
增加接口调用示例
Expand Down

0 comments on commit 35d9b65

Please sign in to comment.