Skip to content

Commit c3c7a73

Browse files
author
OutlyingWest
committed
Add Dockerfile for Binder support
1 parent 340e877 commit c3c7a73

3 files changed

Lines changed: 63 additions & 6 deletions

File tree

.binder/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
FROM ubuntu:20.04
2+
3+
# Set non-interactive frontend to avoid prompts during package installation
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV TZ=Europe/Berlin
6+
7+
# Define Binder-required user variables
8+
ARG NB_USER=jovyan
9+
ARG NB_UID=1000
10+
ENV USER ${NB_USER}
11+
ENV NB_UID ${NB_UID}
12+
ENV HOME /home/${NB_USER}
13+
14+
# Install necessary system dependencies
15+
RUN apt-get update && apt-get install -y \
16+
software-properties-common \
17+
python3 \
18+
python3-pip
19+
20+
# Install scorep from PPA
21+
RUN add-apt-repository -y ppa:andreasgocht/scorep \
22+
&& apt-get update \
23+
&& apt-get install -y scorep
24+
25+
# Upgrade pip and install base Python dependencies
26+
RUN pip3 install pip setuptools wheel
27+
28+
# Install Score-P Python bindings
29+
RUN pip3 install --no-cache-dir scorep
30+
31+
# Install JUmPER kernel
32+
RUN pip3 install --no-cache-dir jumper-kernel && \
33+
python3 -m jumper.install
34+
35+
# Create jovyan user with UID 1000 (Binder requirement)
36+
RUN adduser --disabled-password \
37+
--gecos "Default user" \
38+
--uid ${NB_UID} \
39+
${NB_USER}
40+
41+
# Copy repository contents to the user's home directory
42+
WORKDIR ${HOME}
43+
COPY . ${HOME}
44+
45+
# Change ownership of the directory to the created user
46+
USER root
47+
RUN chown -R ${NB_UID} ${HOME}
48+
USER ${NB_USER}
49+
50+
# Ensure the PATH includes the correct Python location
51+
ENV PATH="${HOME}/.local/bin:${PATH}"
52+
53+
# Install project dependencies from pyproject.toml using pip
54+
RUN pip install --no-cache-dir .
55+
56+
# Install JupyterLab and notebook
57+
RUN pip install --no-cache-dir jupyterlab notebook
58+
59+
# Expose Jupyter Notebook port
60+
EXPOSE 8888
61+
62+
# Set the default command for running Jupyter Notebook
63+
CMD ["jupyter", "notebook", "--NotebookApp.default_url=/lab", "--ip=0.0.0.0", "--port=8888", "--no-browser"]

.binder/environment.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.binder/postBuild

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)