11# Use the jupyter/minimal-notebook as the base image
22FROM quay.io/jupyter/minimal-notebook:latest
33
4+ # Set a shortcut to the tutorial name
5+ ENV BASENAME="python-tutorial"
6+ ENV REPO="https://github.com/edoardob90/${BASENAME}"
7+
8+ # Set the working directory to the home directory of the notebook user
9+ WORKDIR ${HOME}
10+
11+ # Clone the tutorial repository
12+ RUN git clone \
13+ --branch add-dockerfile \
14+ --depth 1 \
15+ ${REPO}
16+
17+ # Set the working directory to the repository directory
18+ WORKDIR ${BASENAME}
19+
420# Switch to root user to install additional dependencies (if needed)
521USER root
622
@@ -16,29 +32,17 @@ RUN apt-get update && \
1632 rm -rf /var/lib/apt/lists/*
1733
1834# Copy the script to setup the environment
19- COPY docker/setup_custom_env.py /opt/setup-scripts/
20- # Make the script executable
21- RUN chmod +x /opt/setup-scripts/setup_custom_env.py
35+ RUN cp -a docker/setup_custom_env.py /opt/setup-scripts/ && \
36+ chmod +x /opt/setup-scripts/setup_custom_env.py
2237
2338# Copy the script to activate the Conda environment
24- COPY docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/
39+ RUN cp -a docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/
2540
2641# Switch back to the default notebook user
2742USER ${NB_UID}
2843
29- # Set a shortcut to the tutorial name
30- ENV BASENAME="python-tutorial"
31-
32- # Set the working directory to the home directory of the notebook user
33- WORKDIR ${HOME}
34-
35- # Clone the tutorial repository
36- RUN git clone \
37- --branch main \
38- --depth 1 \
39- https://github.com/empa-scientific-it/${BASENAME}
40-
41- WORKDIR ${HOME}/${BASENAME}
44+ # Set the working directory to the repository directory
45+ # WORKDIR ${HOME}/${BASENAME}
4246
4347# Create the Conda environment defined in environment.yml
4448RUN mamba env create -f binder/environment.yml && \
@@ -49,7 +53,7 @@ RUN mamba env create -f binder/environment.yml && \
4953# Register the Jupyter kernel from the custom environment
5054RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME}
5155
52- # Copy the IPython configuration file
56+ # Copy the IPython configuration file (binder/postBuild script)
5357RUN mkdir -p ${HOME}/.ipython/profile_default
5458COPY binder/ipython_config.py ${HOME}/.ipython/profile_default/
5559
0 commit comments