diff --git a/Dockerfile b/Dockerfile index fb80462..cf9c279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ -# Python support can be specified down to the minor or micro version -# (e.g. 3.6 or 3.6.3). -# OS Support also exists for jessie & stretch (slim and full). -# See https://hub.docker.com/r/library/python/ for all supported Python -# tags from Docker Hub. -FROM floydhub/pytorch:0.2.0-py3.15 -LABEL Name=chineseocr Version=0.0.1 +FROM ubuntu +MAINTAINER https://github.com/chineseocr/chineseocr +LABEL version="1.0" EXPOSE 8080 - -WORKDIR /app -ADD . /app -RUN cd detector/utils && sh make-for-cpu.sh -RUN git submodule init && git submodule update -RUN cd darknet/ && make && cp libdarknet.so .. -VOLUME /app/models -RUN pip install -r requirements.txt --no-cache-dir -CMD ["python3", "app.py"] +RUN apt-get update +RUN apt-get install libsm6 libxrender1 libxext-dev gcc -y +##下载Anaconda3 python 环境安装包 放置在chineseocr目录 url地址https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh +WORKDIR /chineseocr +ADD . /chineseocr +RUN cd /chineseocr && sh -c '/bin/echo -e "\nyes\n\nyes" | sh Anaconda3-2019.03-Linux-x86_64.sh' +RUN echo -e "\ny" | /root/anaconda3/bin/conda install python=3.6 +RUN /root/anaconda3/bin/pip install easydict opencv-contrib-python==3.4.2.16 Cython h5py pandas requests bs4 matplotlib lxml -U pillow keras==2.1.5 tensorflow==1.8 -i https://pypi.tuna.tsinghua.edu.cn/simple/ +RUN /root/anaconda3/bin/pip install web.py==0.40.dev0 +RUN echo -e "\ny" | /root/anaconda3/bin/conda install pytorch-cpu torchvision-cpu -c pytorch +RUN rm Anaconda3-2019.03-Linux-x86_64.sh +#RUN cd /chineseocr/text/detector/utils && sh make-for-cpu.sh +#RUN conda clean -p +#RUN conda clean -t diff --git a/README.md b/README.md index 43f3e15..72727a4 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,17 @@ cd chineseocr## 进入chineseocr目录 ipython app.py 8080 ##8080端口号,可以设置任意端口 ``` +## 构建docker镜像 +``` Bash +##下载Anaconda3 python 环境安装包(https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh) 放置在chineseocr目录下 +##建立镜像 +docker build -t chineseocr . +##启动服务 +docker run -d -p 8080:8080 chineseocr /root/anaconda3/bin/python app.py + +``` + + ## 识别结果展示 @@ -50,11 +61,6 @@ ipython app.py 8080 ##8080端口号,可以设置任意端口 -## Play with Docker Container(镜像有些滞后) -``` Bash -docker pull zergmk2/chineseocr -docker run -d -p 8080:8080 zergmk2/chineseocr -``` ## 访问服务 http://127.0.0.1:8080/ocr diff --git a/docker.sh b/docker.sh new file mode 100644 index 0000000..1cd5fe6 --- /dev/null +++ b/docker.sh @@ -0,0 +1,6 @@ +##拉取基础镜像 +docker build -t chineseocr . +##启动服务 +docker run -d -p 8080:8080 chineseocr /root/anaconda3/bin/python app.py + +