Last active
May 1, 2020 19:57
-
-
Save nbroad1881/099a004b696b626638d74c31ab0a3bad to your computer and use it in GitHub Desktop.
dev environment using jupyter lab and docker
This file contains hidden or 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
# ************************************************** | |
# Commands to run this dockerfile | |
# $docker build -t name_of_image directory | |
# | |
# $docker run -v ~/path/to/local/dir:/root/work -it --name my_container -p 8888:8888 --rm name_of_image | |
# (-v stands for volumes. This mounts a local dir to a dir in the container) | |
# -v ~/path/to/local/dir:/root/work -it \ | |
# (-it stands for interactive. Any changes to local dir will then be seen in the connected dir in the container | |
# --name my_container \ | |
# (map port 8888 on computer to port 8888 on container. default port for jupyterlab) | |
# -p 8888:8888 | |
# (delete container after done) | |
# -rm | |
# (name of image to load from) | |
# name_of_image | |
# ************************************************** | |
FROM ubuntu:18.04 | |
# Set character encoding environment variables | |
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 | |
# Allow apt-get install without interaction from console | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Set the working dir to the root user home folder | |
WORKDIR /root | |
RUN apt-get update && apt-get -y --no-install-recommends install \ | |
ca-certificates \ | |
git \ | |
ssh \ | |
wget && \ | |
apt-get clean && \ | |
apt-get autoremove && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install Miniconda | |
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.1-Linux-x86_64.sh && \ | |
bash Miniconda3-4.5.1-Linux-x86_64.sh -b -p $HOME/miniconda && \ | |
echo 'source $HOME/miniconda/bin/activate' >> .bashrc && \ | |
rm Miniconda3-4.5.1-Linux-x86_64.sh | |
# Set the path env to include miniconda | |
ENV PATH /root/miniconda/bin:$PATH | |
RUN mkdir -p ~/.jupyter | |
COPY jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py | |
# Install python packages | |
COPY requirements.txt . | |
RUN pip install --upgrade pip setuptools && \ | |
pip install -r requirements.txt --no-cache-dir | |
RUN mkdir -p /root/work | |
CMD ["jupyter", "lab", "--no-browser","--NotebookApp.token=''","--NotebookApp.password=''"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment