From 6fb304a49d70fc871fa3fd3c9bd61ab4fbdce3be Mon Sep 17 00:00:00 2001 From: dx-tan Date: Tue, 26 Dec 2023 10:39:03 +0700 Subject: [PATCH] Update: Docker base --- .gitignore | 5 ++- cope2n-ai-fi/Dockerfile | 68 ++++++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 06e3308..de72e23 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,7 @@ curl.md cope2n-api/fwd_api/commands/init_database.py /data backup -demo-ocr/ \ No newline at end of file +demo-ocr/ +logs/ +docker-compose_.yml +cope2n-ai-fi/Dockerfile_old_work diff --git a/cope2n-ai-fi/Dockerfile b/cope2n-ai-fi/Dockerfile index 405796c..1bb583f 100755 --- a/cope2n-ai-fi/Dockerfile +++ b/cope2n-ai-fi/Dockerfile @@ -1,40 +1,64 @@ -FROM thucpd2408/env-deskew +FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime -COPY ./packages/cudnn-linux*.tar.xz /tmp/cudnn-linux*.tar.xz +RUN apt-get update && \ + apt-get install -y git gcc g++ ffmpeg libsm6 libxext6 && \ + apt-get -y autoremove && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* -RUN tar -xvf /tmp/cudnn-linux*.tar.xz -C /tmp/ \ - && cp /tmp/cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include \ - && cp -P /tmp/cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64 \ - && chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn* \ - && rm -rf /tmp/cudnn-*-archive +# RUN pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116 --no-cache-dir -RUN apt-get update && apt-get install -y gcc g++ ffmpeg libsm6 libxext6 poppler-utils +RUN pip install -U openmim==0.3.7 --no-cache-dir +RUN mim install mmcv-full==1.7.1 +RUN pip install mmcv==1.6.0 -f https://download.openmmlab.com/mmcv/dst/cu116/torch1.13/index.html --no-cache-dir -WORKDIR /workspace +RUN ln -s /opt/conda/lib/python3.10/site-packages/torch/lib/libcudnn.so.8 /usr/lib/libcudnn.so && \ + ln -s /opt/conda/lib/libcublas.so /usr/lib/libcublas.so +RUN python -m pip install paddlepaddle-gpu==2.4.2.post116 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html --no-cache-dir -# COPY ./modules/ocr_engine/externals/ /workspace/cope2n-ai-fi/modules/ocr_engine/externals/ -# COPY ./modules/ocr_engine/requirements.txt /workspace/cope2n-ai-fi/modules/ocr_engine/requirements.txt -# COPY ./modules/sdsvkvu/ /workspace/cope2n-ai-fi/modules/sdsvkvu/ -# COPY ./requirements.txt /workspace/cope2n-ai-fi/requirements.txt +RUN python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' --no-cache-dir +# Install SDSV packages COPY . /workspace/cope2n-ai-fi -RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsv_dewarp && pip3 install -v -e . -RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtd && pip3 install -v -e . -RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtr && pip3 install -v -e . +RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsv_dewarp && pip3 install -v -e . --no-cache-dir +RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtd && pip3 install -v -e . --no-cache-dir +RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtr && pip3 install -v -e . --no-cache-dir -RUN cd /workspace/cope2n-ai-fi/modules/sdsvkvu && pip3 install -v -e . -RUN cd /workspace/cope2n-ai-fi && pip3 install -r requirements.txt +# COPY ./modules/sdsvkvu/sdsvkvu/externals/sdsvocr/externals/sdsv_dewarp /tmp/sdsv_dewarp +# RUN cd /tmp/sdsv_dewarp && pip install -v -e . --no-cache-dir + +# COPY ./modules/sdsvkvu/sdsvkvu/externals/sdsvocr/externals/sdsvtd /tmp/sdsvtd +# RUN cd /tmp/sdsvtd && pip install -v -e . --no-cache-dir + +# COPY ./modules/sdsvkvu/sdsvkvu/externals/sdsvocr/externals/sdsvtr /tmp/sdsvtr +# RUN cd /tmp/sdsvtr && pip install -v -e . --no-cache-dir + +# COPY ./modules/sdsvkvu/sdsvkvu/externals/sdsvocr/requirements.txt /tmp/sdsvocr/requirements.txt +# RUN pip install -r /tmp/sdsvocr/requirements.txt + +# ENV PIP_DEFAULT_TIMEOUT 100 +# COPY ./modules/sdsvkvu /tmp/sdsvkvu +# RUN cd /tmp/sdsvkvu && pip install -v -e . --no-cache-dir + +# COPY ./requirements.txt /tmp/requirements.txt +# RUN pip install -r /tmp/requirements.txt --no-cache-dir + +RUN cd /workspace/cope2n-ai-fi/modules/sdsvkvu && pip3 install -v -e . --no-cache-dir +RUN cd /workspace/cope2n-ai-fi && pip3 install -r requirements.txt --no-cache-dir RUN rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 && \ - ln -s /usr/local/cuda-11.8/targets/x86_64-linux/lib/libcublasLt.so.11 /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ - ln -s /usr/local/cuda-11.8/targets/x86_64-linux/lib/libcublas.so.11 /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ - ln -s /usr/local/cuda-11.8/targets/x86_64-linux/lib/libnvblas.so.11 /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 + ln -s /opt/conda/lib/libcublasLt.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ + ln -s /opt/conda/lib/libcublas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ + ln -s /opt/conda/lib/libnvblas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 + + +WORKDIR /workspace ENV PYTHONPATH="." ENV TZ="Asia/Ho_Chi_Minh" -CMD [ "sh", "run.sh"] +CMD [ "sh", "run.sh"] \ No newline at end of file