Dockerfile.dev 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. FROM node:16.15.1-bullseye-slim AS builder-fe
  2. COPY docker_build/requirements.txt .
  3. RUN echo "deb http://mirror.nju.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list && \
  4. echo "deb http://mirror.nju.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \
  5. echo "deb http://mirror.nju.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list && \
  6. echo "deb http://mirror.nju.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \
  7. apt update && apt install -y python3 python3-pip python-is-python3 make \
  8. && pip config set global.index-url https://mirror.nju.edu.cn/pypi/web/simple \
  9. && pip install -U pip setuptools && pip install -r requirements.txt \
  10. && yarn config set registry https://registry.npmmirror.com
  11. COPY . /src/
  12. ENV PYTHONPATH=/src
  13. RUN cd /src && chmod a+x ./bdist_wheel.sh && ./bdist_wheel.sh
  14. FROM ubuntu:18.04 AS builder
  15. RUN sed -i 's#archive.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list \
  16. && sed -i 's#security.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list
  17. ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8 DEBIAN_FRONTEND=noninteractive
  18. RUN rm -rf /etc/apt/sources.list.d/ && apt update
  19. RUN apt-get update && apt-get install -y --no-install-recommends \
  20. supervisor \
  21. iputils-ping \
  22. wget \
  23. zsh \
  24. build-essential \
  25. cmake \
  26. git \
  27. curl \
  28. vim \
  29. ca-certificates \
  30. libjpeg-dev \
  31. zip \
  32. unzip \
  33. libpng-dev \
  34. openssh-server \
  35. autojump \
  36. language-pack-zh-hans \
  37. ttf-wqy-zenhei \
  38. libgl1-mesa-glx \
  39. libglib2.0-0 \
  40. locales &&\
  41. rm -rf /var/lib/apt/lists/*
  42. RUN locale-gen zh_CN.UTF-8
  43. RUN dpkg-reconfigure locales
  44. CMD ["supervisord", "-n"]
  45. FROM builder as builder1
  46. ENV PYTHON_VERSION 3
  47. RUN chsh -s `which zsh`
  48. RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh && \
  49. chmod +x ~/miniconda.sh && \
  50. ~/miniconda.sh -b -p /opt/conda && \
  51. rm ~/miniconda.sh
  52. RUN ln /opt/conda/bin/conda /usr/local/bin/conda
  53. RUN conda init zsh
  54. RUN conda install mamba -n base -c conda-forge
  55. RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh
  56. FROM builder1 as builder2
  57. WORKDIR /workspace
  58. COPY --from=builder-fe /src/dist dist
  59. RUN /opt/conda/bin/pip install dist/*.whl
  60. RUN /opt/conda/bin/pip install jupyterlab-language-pack-zh-CN -i https://pypi.douban.com/simple
  61. RUN mamba install nodejs
  62. RUN /opt/conda/bin/jupyter lab --generate-config && \
  63. echo "c.NotebookApp.password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$+zIUCF9Uk2FiCHlV8njX5A\$I5Mm/64DORArcXYTXWRVng'">>/root/.jupyter/jupyter_lab_config.py
  64. RUN mkdir -p /workspace && echo "\
  65. [program:jupyter]\n\
  66. directory=/workspace\n\
  67. command=/opt/conda/bin/jupyter lab --ip 0.0.0.0 --port 8888 --allow-root --no-browser \n\
  68. autorestart=true\n\
  69. startretries=0\n\
  70. redirect_stderr=true\n\
  71. stdout_logfile=/var/log/jupyter.log\n\
  72. stdout_logfile_maxbytes=50MB\n\
  73. " > /etc/supervisor/conf.d/jupyter.conf
  74. EXPOSE 8888