Dockerfile 3.7 KB

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