Last active
June 4, 2020 15:00
-
-
Save luminoso/bcdfed320eb1dec3da80ab902dd957f9 to your computer and use it in GitHub Desktop.
Docker jupyterlab under condas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
# | |
# 1. Hadoop | |
# | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get -qq update && apt-get -qq -y install openjdk-14-jdk-headless wget build-essential krb5-user\ | |
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log | |
RUN wget -q https://archive.apache.org/dist/hadoop/common/hadoop-3.2.1/hadoop-3.2.1.tar.gz \ | |
&& tar -zxf hadoop-3.2.1.tar.gz \ | |
&& ln -s /hadoop-3.2.1 /opt/hadoop \ | |
&& rm hadoop-3.2.1.tar.gz | |
ENV JAVA_HOME=/usr/lib/jvm/java-14-openjdk-amd64/ | |
ENV HADOOP_HOME=/opt/hadoop | |
ENV HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop | |
ENV YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop | |
ENV HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native | |
ENV LD_LIBRARY_PATH=$HADOOP_COMMON_LIB_NATIVE_DIR:$LD_LIBRARY_PATH | |
ENV PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin | |
COPY hdfs-site.xml /opt/hadoop/etc/hadoop/ | |
COPY core-site.xml /opt/hadoop/etc/hadoop/ | |
COPY krb5.conf /etc/krb5.conf | |
# | |
# 2. Conda base install | |
# https://github.com/conda/conda-docker/blob/master/miniconda3/debian/Dockerfile | |
# | |
RUN apt-get -qq update && apt-get -qq -y install curl bzip2 \ | |
&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \ | |
&& bash /tmp/miniconda.sh -bfp /usr/local \ | |
&& rm -rf /tmp/miniconda.sh \ | |
&& conda install -y python=3 \ | |
&& conda update conda \ | |
&& apt-get -qq -y remove curl bzip2 \ | |
&& apt-get -qq -y autoremove \ | |
&& apt-get autoclean \ | |
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \ | |
&& conda clean --all --yes | |
ENV PATH /opt/conda/bin:$PATH | |
# | |
# 3. General utils | |
# | |
RUN apt-get -qq update && apt-get -qq -y install zip git iputils-ping subversion htop \ | |
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log | |
# | |
# 4. Jupyter and working env | |
# | |
RUN useradd -m jupyter -s /bin/bash | |
USER jupyter | |
RUN conda config --add channels conda-forge \ | |
&& conda config --set channel_priority strict | |
RUN conda create --strict-channel-priority -n jupyter python=3.8 | |
RUN conda init bash | |
SHELL ["/bin/bash", "-c"] | |
#RUN . /usr/local/etc/profile.d/conda.sh | |
SHELL ["conda", "run", "-n", "jupyter", "/bin/bash", "-c"] | |
#RUN conda activate jupyter | |
RUN conda update -y --all | |
RUN conda install -y jupyterlab jupyter_contrib_nbextensions nodejs | |
# https://github.com/jupyterlab/debugger | |
RUN conda install -y xeus-python notebook | |
RUN jupyter labextension install @jupyterlab/debugger --no-build | |
# https://github.com/jupyter-widgets/ipywidgets | |
RUN conda install -y ipywidgets | |
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build | |
# https://github.com/jupyterlab/jupyterlab-toc | |
RUN jupyter labextension install @jupyterlab/toc --no-build | |
# https://github.com/wallneradam/jupyterlab-run-all-buttons#readme | |
RUN jupyter labextension install @wallneradam/run_all_buttons --no-build | |
# https://jupyterlab-code-formatter.readthedocs.io/ | |
RUN conda install -y black isort | |
RUN jupyter labextension install @ryantam626/jupyterlab_code_formatter --no-build | |
RUN conda install -y jupyterlab_code_formatter | |
RUN jupyter serverextension enable --py jupyterlab_code_formatter | |
# https://github.com/jupyterlab/jupyterlab-git | |
RUN conda install jupyterlab-git | |
RUN jupyter lab build | |
# final useful libs | |
RUN conda install -y pandas numpy scipy tqdm ipython-autotime scikit-learn tqdm pyarrow | |
RUN conda clean --all --yes | |
# | |
# 5. Finalize docker | |
# | |
EXPOSE 8888 | |
RUN mkdir /home/jupyter/notebooks | |
WORKDIR /home/jupyter/notebooks | |
RUN echo "conda activate jupyter" >> /home/jupyter/.bashrc | |
SHELL ["/bin/bash", "-c"] | |
ENTRYPOINT source activate jupyter && jupyter-lab --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.ip='0.0.0.0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment