tiancheng91 / collection

笔记
https://github.com/tiancheng91/collection/issues
22 stars 1 forks source link

paddleocr nvidia 镜像 #72

Open tiancheng91 opened 1 year ago

tiancheng91 commented 1 year ago
# Version: 2.0.0
FROM nvidia/cuda:11.7.0-cudnn8-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND noninteractive
ENV TZ="Asia/Shanghai"
USER root
WORKDIR /PaddleOCR

# utils
RUN sed -i 's/archive.ubuntu.com/mirrors.cloud.aliyuncs.com/g' /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y python3-pip python-is-python3 wget aria2 git git-lfs vim && rm -rf /var/lib/apt/lists/* && apt-get clean
RUN apt-get update -y && apt-get install -y cuda-nvcc-11-7 libcudnn8=8.5.0.96-1+cuda11.7 libgl1 libglib2.0-0 
RUN apt-get update -y && apt-get install -y --allow-change-held-packages libcublas-11-7
RUN cd /usr/lib/x86_64-linux-gnu && ln -s libcudnn.so.8.5.0 libcudnn.so && ln -s /usr/local/cuda-11.7/lib64/libcublas.so.11 libcublas.so

RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN python -m pip install paddlepaddle-gpu==2.4.2.post117 paddleocr paddlehub -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html && pip cache purge

RUN git clone -b release/2.6 https://github.com/PaddlePaddle/PaddleOCR.git /PaddleOCR
RUN pip install -r requirements.txt && pip cache purge

RUN mkdir -p /PaddleOCR/inference/ && cd /PaddleOCR/inference/ && \
    wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar && \
    wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar && \
    wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar && \
    tar -xf ch_PP-OCRv3_det_infer.tar && tar -xf ch_ppocr_mobile_v2.0_cls_infer.tar && tar -xf ch_PP-OCRv3_rec_infer.tar && rm -rf *.tar 

EXPOSE 8868

CMD ["/bin/bash","-c","hub install deploy/hubserving/ocr_system/ && hub serving start -m ocr_system --use_gpu -p 8868"]