Dockerfile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 AS builder
  2. FROM pytorch/pytorch:1.7.1-cuda11.0-cudnn8-devel 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. RUN ln /opt/conda/bin/conda /usr/local/bin/conda
  41. RUN conda init zsh
  42. RUN conda install mamba -n base -c conda-forge
  43. RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh
  44. FROM builder1 as builder2
  45. RUN apt-get update && apt-get install -y --no-install-recommends openssh-server && rm -rf /var/lib/apt/lists/*
  46. RUN mkdir /var/run/sshd
  47. RUN echo 'root:root' | chpasswd
  48. RUN sed -i 's/.*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
  49. # SSH login fix. Otherwise user is kicked off after login
  50. RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
  51. RUN echo "\
  52. [program:sshd] \n\
  53. command=/usr/sbin/sshd -D\n\
  54. autorestart=True\n\
  55. autostart=True\n\
  56. redirect_stderr = true\n\
  57. " > /etc/supervisor/conf.d/sshd.conf
  58. EXPOSE 22
  59. FROM builder2 as builder3
  60. WORKDIR /workspace
  61. ADD environment.yml /environment.yml
  62. RUN sed -i 's#- paddlepaddle#- paddlepaddle-gpu==2.3.0.post110#g' /environment.yml && cat /environment.yml
  63. RUN mamba update -n base -c defaults conda -y && mamba env update -f /environment.yml && rm -rf /root/.cache
  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/bin/gunicorn server:app --workers 1 --worker-class=uvicorn.workers.UvicornWorker --bind 0.0.0.0:8080 --log-level=info --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. environment=CUDA_VISIBLE_DEVICES=0,PYTHONPATH=/worksapce/yolov5\n\
  77. " > /etc/supervisor/conf.d/be.conf
  78. # envs/py38/
  79. RUN git clone https://gitee.com/monkeycc/yolov5.git
  80. # RUN wget --user=sxkj --password='sx' ftp://192.168.199.208/yili.pt
  81. # RUN wget --user=sxkj --password='sx' ftp://192.168.199.208/best.pt
  82. # RUN wget --user=sxkj --password='sx' ftp://192.168.199.208/best2.pt
  83. #RUN wget --user=sxkj --password='sx' ftp://192.168.199.208/8-14_layout_model.pt
  84. #RUN wget --user=sxkj --password='sx' ftp://192.168.199.208/0822yili.pt
  85. RUN wget ftp://192.168.199.31/11-17.pt
  86. RUN wget ftp://192.168.199.31/logo.pt
  87. ADD . /workspace
  88. EXPOSE 8080
  89. # RUN mamba install -y jupyterlab -n base && mamba init zsh
  90. # RUN /opt/conda/bin/jupyter notebook --generate-config && \
  91. # echo "c.NotebookApp.password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$+zIUCF9Uk2FiCHlV8njX5A\$I5Mm/64DORArcXYTXWRVng'">>/root/.jupyter/jupyter_notebook_config.py
  92. # RUN mkdir -p /data && echo "\
  93. # [program:jupyter]\n\
  94. # directory=/data\n\
  95. # command=/opt/conda/bin/jupyter lab --ip 0.0.0.0 --port 8888 --allow-root --no-browser \n\
  96. # autorestart=true\n\
  97. # startretries=0\n\
  98. # redirect_stderr=true\n\
  99. # stdout_logfile=/dev/stdout\n\
  100. # stdout_logfile_maxbytes=0\n\
  101. # " > /etc/supervisor/conf.d/jupyter.conf
  102. # EXPOSE 8888