- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
Latest commit
66 lines (55 loc) · 2.61 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (55 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This is Binder-compatible Dockerfile, which will enable:
# - Online execution via https://mybinder.org/ or a similar environment
# - Local execution via Docker
# Ensuring compatibility requires some care in the Dockerfile definition;
# detailed instructions are available at:
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
# while some notes are provided directly in this file as commments
# Specify the base image
# NOTE: Binder requires a tag to be specified
FROM python:3.8
# Define a user whose uid is 1000
# NOTE: this is required for Binder compatibility, to ensure that processes
# are not run as root. The "adduser" command is fine for Debian-based images
# (such as python:3.8) and should be replaced when a different distribution
# is used. Keep this as it is unless you know what you are doing
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
# Install minimal requirements
# NOTE: these are for Binder compatibility. You can change the jupyter and
# jupyterhub versions, but referring a specific version is highly advised
# to ensure reproducibility. Feel free to update the version tags, but it's
# better to keep both packages installed
RUN pip install --no-cache-dir notebook==6.2.0
RUN pip install --no-cache-dir jupyterhub
# CONTAINER SPECIFIC INSTALLATION -------------------------------------------
# Most of the configuration steps specific to your container can fit here
# Update the package manager and install a simple module. The RUN command
# will execute a command on the container and then save a snapshot of the
# results. The last of these snapshots will be the final image
RUN apt-get update -y && apt-get install -y zip
# Install additional Python packages
RUN pip install --no-cache-dir pandas matplotlib
# END OF THE CONTAINER SPECIFIC INSTALLATION --------------------------------
# Make sure the contents of our repo are in ${HOME}
# NOTE: this is needed again by Binder, to make the notebook contents
# available to all users. We also need to change the ownership of the home
# directory we previously built. The snippet ends with a user switch
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}
# Specify working directory
WORKDIR ${HOME}
# Use CMD to specify the starting command
# NOTE: Binder will override this by explicitily calling a program (jupyter)
# within the container, and by passing its own list of arguments
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", \
"--ip=0.0.0.0", "--allow-root"]