Dockerfile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. FROM condaforge/mambaforge:latest AS builder0
  2. #FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 AS builder
  3. FROM SXKJ:32775/nvidia-cuda-11.0-cudnn8.0:latest AS builder
  4. RUN sed -i 's#archive.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list \
  5. && sed -i 's#security.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list
  6. ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8 DEBIAN_FRONTEND=noninteractive
  7. RUN rm -rf /etc/apt/sources.list.d/ && apt update
  8. RUN apt-get update && apt-get install -y --no-install-recommends \
  9. supervisor \
  10. iputils-ping \
  11. wget \
  12. zsh \
  13. build-essential \
  14. cmake \
  15. git \
  16. curl \
  17. vim \
  18. ca-certificates \
  19. libjpeg-dev \
  20. zip \
  21. unzip \
  22. libpng-dev \
  23. openssh-server \
  24. autojump \
  25. language-pack-zh-hans \
  26. ttf-wqy-zenhei \
  27. libgl1-mesa-glx \
  28. libglib2.0-0 \
  29. locales &&\
  30. rm -rf /var/lib/apt/lists/*
  31. RUN locale-gen zh_CN.UTF-8
  32. RUN dpkg-reconfigure locales
  33. CMD ["supervisord", "-n"]
  34. FROM builder as builder1
  35. # ENV PYTHON_VERSION 3
  36. # RUN chsh -s `which zsh`
  37. # RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh && \
  38. # chmod +x ~/miniconda.sh && \
  39. # ~/miniconda.sh -b -p /opt/conda && \
  40. # rm ~/miniconda.sh
  41. COPY --from=builder0 /opt/conda /opt/conda
  42. RUN ln /opt/conda/bin/conda /usr/local/bin/conda
  43. RUN conda init zsh
  44. # RUN conda install 'mamba<=1.4.5' -n base -c conda-forge
  45. RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh
  46. FROM builder1 as builder2
  47. RUN apt-get update && apt-get install -y --no-install-recommends openssh-server && rm -rf /var/lib/apt/lists/*
  48. RUN mkdir /var/run/sshd
  49. RUN echo 'root:root' | chpasswd
  50. RUN sed -i 's/.*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
  51. # SSH login fix. Otherwise user is kicked off after login
  52. RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
  53. RUN echo "\
  54. [program:sshd] \n\
  55. command=/usr/sbin/sshd -D\n\
  56. autorestart=True\n\
  57. autostart=True\n\
  58. redirect_stderr = true\n\
  59. " > /etc/supervisor/conf.d/sshd.conf
  60. EXPOSE 22
  61. FROM builder2 as builder3
  62. WORKDIR /workspace
  63. ADD environment.yml /environment.yml
  64. RUN sed -i 's#- paddlepaddle#- paddlepaddle-gpu==2.3.0.post110#g' /environment.yml && cat /environment.yml
  65. RUN mamba update -n base -c defaults conda -y && mamba env create -f /environment.yml && rm -rf /root/.cache
  66. # RUN /opt/conda/envs/py38/bin/python -m ipykernel install --name py38 --display-name "py38"
  67. # RUN echo "c.MultiKernelManager.default_kernel_name = 'py38'">>/root/.jupyter/jupyter_notebook_config.py
  68. RUN mkdir -p /var/log/be
  69. RUN echo "\
  70. [program:be]\n\
  71. directory=/workspace\n\
  72. command=/opt/conda/envs/py38/bin/python run.py \n\
  73. autorestart=true\n\
  74. startretries=0\n\
  75. redirect_stderr=true\n\
  76. stdout_logfile=/var/log/be/be.log\n\
  77. stdout_logfile_maxbytes=50MB\n\
  78. " > /etc/supervisor/conf.d/be.conf
  79. RUN cd / && wget ftp://192.168.199.31/table-paddleclas.tgz && tar xvf table-paddleclas.tgz
  80. RUN cd / && wget ftp://192.168.199.31/table-paddleocr.tgz && tar xvf table-paddleocr.tgz
  81. RUN mkdir -p models/det && cd models/det && wget ftp://192.168.199.31/det_pse/table/20240223/det_pse.zip && unzip det_pse.zip -d tmp && mv tmp/det_pse det_pse_quad && rm -r tmp && rm det_pse.zip
  82. Add . /workspace
  83. EXPOSE 8080
  84. # RUN mamba install -y jupyterlab -n base && mamba init zsh
  85. # RUN /opt/conda/bin/jupyter notebook --generate-config && \
  86. # echo "c.NotebookApp.password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$+zIUCF9Uk2FiCHlV8njX5A\$I5Mm/64DORArcXYTXWRVng'">>/root/.jupyter/jupyter_notebook_config.py
  87. # RUN mkdir -p /data && echo "\
  88. # [program:jupyter]\n\
  89. # directory=/data\n\
  90. # command=/opt/conda/bin/jupyter lab --ip 0.0.0.0 --port 8888 --allow-root --no-browser \n\
  91. # autorestart=true\n\
  92. # startretries=0\n\
  93. # redirect_stderr=true\n\
  94. # stdout_logfile=/dev/stdout\n\
  95. # stdout_logfile_maxbytes=0\n\
  96. # " > /etc/supervisor/conf.d/jupyter.conf
  97. # EXPOSE 8888