-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathDockerfile
More file actions
103 lines (77 loc) · 2.85 KB
/
Dockerfile
File metadata and controls
103 lines (77 loc) · 2.85 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Dockerfile for fuzzingbook/debuggingbook (experimental)
# The repo2docker script takes a _very_ long time to execute,
# causing timeouts on mybinder. So, we provide this lightweight
# Dockerfile instead.
# To test, use
# make docker-image
# and then
# make docker-run (for a jupyter notebook)
# make docker-shell (for a bash shell)
# For more info, see
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
# https://github.com/binder-examples/minimal-dockerfile
# This Dockerfile is meant to be used in the mybinder environment,
# but it can also serve as a base to deploy docker images.
# From docker2repo
FROM docker.io/library/buildpack-deps:jammy
# Project name
ARG PROJECT=debuggingbook
ARG REPO=https://github.com/uds-se/${PROJECT}.git
# Meta-data
LABEL description="${PROJECT}.org image from ${REPO}"
# Install git and pip
RUN apt-get update
RUN apt-get install -y git python3 python-is-python3 pip npm gcc
# Some version info
RUN echo "This is ${PROJECT} with $(python --version)" 1>&2
# Install graphviz
# For some reason, this may fail when installing via 'apt.txt' (see below)
RUN apt-get install -y graphviz libgraphviz-dev
# Install jupyter
RUN pip install --no-cache --upgrade pip && \
pip install --no-cache notebook jupyterlab
# Install mermaid
RUN npm i -g mermaid
# From postBuild script – apparently, we have to run this as root
RUN pip install jupyterlab-markup
RUN pip install jupyterlab-cell-flash
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
# Add the default user
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER=${NB_USER}
ENV HOME=/home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
WORKDIR ${HOME}
# Make sure the contents of our repo are in ${HOME}
COPY . ${HOME}
WORKDIR ${HOME}
# Get the repo
RUN git clone --depth 1 ${REPO}
RUN chown -R ${NB_UID} ${HOME}
WORKDIR ${PROJECT}
# Install the required Linux packages
RUN apt-get install -y $(grep -v '^#' binder/apt.txt); exit 0
# From here on, we are a user
USER ${NB_USER}
# Add local bin path
ENV PATH="/home/${NB_USER}/.local/bin:$PATH"
# Diagnostics
RUN python3 -c 'import sys, platform; print(sys.version, sys.platform, platform.machine(), file=sys.stderr)'
# Set up the conda environment
# (Skipping for now, as installing conda is hard,
# and apparently we can do without)
# RUN conda env create -f binder/environment.yml
# RUN conda activate myenv
# Install the required Python packages
RUN python3 -m pip install .
RUN python3 -m pip install ".[binder]"
# Run the postBuild script (to set up Jupyter, sign notebooks and more)
RUN bash binder/postBuild
# Expose port 8888, so it can be reached from the outside (for local testing)
EXPOSE 8888
# If nothing else is specified, start a Jupyter server
CMD ["sh", "-c", "jupyter lab --port=8888 --no-browser --ip=* docs/notebooks"]