FROM node:16.15.1-bullseye-slim AS builder-fe COPY docker_build/requirements.txt . RUN echo "deb http://mirror.nju.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list && \ echo "deb http://mirror.nju.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://mirror.nju.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://mirror.nju.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ apt update && apt install -y python3 python3-pip python-is-python3 make \ && pip config set global.index-url https://pypi.douban.com/simple \ && pip install -U pip setuptools && pip install -r requirements.txt \ && yarn config set registry https://registry.npm.taobao.org #https://registry.npmmirror.com COPY . /src/ ENV PYTHONPATH=/src RUN cd /src && chmod a+x ./bdist_wheel.sh && ./bdist_wheel.sh FROM ubuntu:18.04 AS builder RUN sed -i 's#archive.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list \ && sed -i 's#security.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8 DEBIAN_FRONTEND=noninteractive RUN rm -rf /etc/apt/sources.list.d/ && apt update RUN apt-get update && apt-get install -y --no-install-recommends \ supervisor \ iputils-ping \ wget \ zsh \ build-essential \ cmake \ git \ curl \ vim \ ca-certificates \ libjpeg-dev \ zip \ unzip \ libpng-dev \ openssh-server \ autojump \ language-pack-zh-hans \ ttf-wqy-zenhei \ libgl1-mesa-glx \ libglib2.0-0 \ locales &&\ rm -rf /var/lib/apt/lists/* RUN locale-gen zh_CN.UTF-8 RUN dpkg-reconfigure locales CMD ["supervisord", "-n"] FROM builder as builder1 ENV PYTHON_VERSION 3 RUN chsh -s `which zsh` RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh && \ chmod +x ~/miniconda.sh && \ ~/miniconda.sh -b -p /opt/conda && \ rm ~/miniconda.sh RUN ln /opt/conda/bin/conda /usr/local/bin/conda RUN conda init zsh RUN conda install mamba -n base -c conda-forge RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh FROM builder1 as builder2 WORKDIR /workspace COPY --from=builder-fe /src/dist dist RUN /opt/conda/bin/pip install dist/*.whl -i https://pypi.douban.com/simple RUN /opt/conda/bin/pip install jupyterlab-language-pack-zh-CN -i https://pypi.douban.com/simple RUN mamba install nodejs # password 'sx' RUN /opt/conda/bin/jupyter lab --generate-config && \ echo "c.NotebookApp.password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$+zIUCF9Uk2FiCHlV8njX5A\$I5Mm/64DORArcXYTXWRVng'">>/root/.jupyter/jupyter_lab_config.py FROM builder2 as builder3 RUN apt-get update && apt-get install -y --no-install-recommends openjdk-8-jdk krb5-user RUN mamba install nodejs sparkmagic pyhive thrift sasl thrift_sasl -y # RUN /opt/conda/bin/pip install sparkmagipc -i https://pypi.douban.com/simple ENV PATH /opt/conda/bin/:$PATH RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension RUN cd /opt/conda/lib/python3.9/site-packages/ \ && jupyter-kernelspec install sparkmagic/kernels/sparkkernel --user \ && jupyter-kernelspec install sparkmagic/kernels/pysparkkernel --user\ && /opt/conda/bin/jupyter serverextension enable --py sparkmagic RUN /opt/conda/bin/pip install dist/*.whl -i https://pypi.douban.com/simple ADD confs/krb5.conf /etc/ ADD confs/config.json ~/.sparkmagic/config.json ADD emr-5xjsy31f_ailab.keytab / # RUN kinit -k -t emr-5xjsy31f_ailab.keytab ailab RUN echo "\ [program:jupyter]\n\ directory=/workspace\n\ command=/bin/bash -c 'kinit -k -t /emr-5xjsy31f_ailab.keytab ailab && /opt/conda/bin/jupyter lab --ip 0.0.0.0 --port 8888 --allow-root --no-browser' \n\ autorestart=true\n\ startretries=0\n\ redirect_stderr=true\n\ stdout_logfile=/var/log/jupyter.log\n\ stdout_logfile_maxbytes=50MB\n\ " > /etc/supervisor/conf.d/jupyter.conf EXPOSE 8888