Skip to content

Commit b7d81d2

Browse files
feat: Add Binder support (#23)
* Add minimal Dockerfile for repo2docker to build and launch successfully from matthewfeickert/pythia-python:pythia8.308. - Constrain 'jupyter-server<2.0.0' to avoid jupyterhub/repo2docker#1231 and jupyter-server/jupyter_server#1038 * Add binder_repo2docker Make target for local building with repo2docker. * Add Binder launch badge to README.
1 parent c70139a commit b7d81d2

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

Diff for: Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ test_fastjet:
4848
--volume $(shell pwd):/work \
4949
matthewfeickert/pythia-python:latest \
5050
'g++ tests/test_FastJet.cc -o tests/test_FastJet $$(fastjet-config --cxxflags --libs --plugins); ./tests/test_FastJet'
51+
52+
binder_repo2docker:
53+
repo2docker \
54+
--image-name matthewfeickert/pythia-python:binder \
55+
.

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Docker Pulls](https://img.shields.io/docker/pulls/matthewfeickert/pythia-python)](https://hub.docker.com/r/matthewfeickert/pythia-python)
44
[![Docker Image Size (tag)](https://img.shields.io/docker/image-size/matthewfeickert/pythia-python/latest)](https://hub.docker.com/r/matthewfeickert/pythia-python/tags?name=latest)
5+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/matthewfeickert/pythia-python/HEAD)
56

67
> PYTHIA is a program for the generation of high-energy physics events, i.e. for the description of collisions at high energies between elementary particles such as e+, e-, p and pbar in various combinations.
78

Diff for: binder/Dockerfile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM matthewfeickert/pythia-python:pythia8.308
2+
3+
# Remove existing non-root user "docker" with uid 1000
4+
# to avoid conflict with jovyan
5+
USER root
6+
RUN deluser docker
7+
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+
USER root
15+
RUN adduser --disabled-password \
16+
--gecos "Default user" \
17+
--uid ${NB_UID} \
18+
${NB_USER}
19+
USER ${NB_USER}
20+
21+
# FIXME: Downgrade jupyter-server to contend with:
22+
# https://github.com/jupyterhub/repo2docker/issues/1231
23+
# https://github.com/jupyter-server/jupyter_server/issues/1038
24+
RUN python -m pip --no-cache-dir install --upgrade \
25+
notebook \
26+
jupyterlab \
27+
jupyterhub \
28+
'jupyter-server<2.0.0'
29+
30+
# Make sure the contents of the repo are in ${HOME}
31+
COPY . ${HOME}
32+
USER root
33+
RUN chown -R ${NB_UID} ${HOME} && \
34+
chown -R ${NB_UID} /usr/local/venv
35+
USER ${NB_USER}
36+
WORKDIR ${HOME}
37+
38+
# Null out ENTRYPOINT and CMD to let repo2docker control them
39+
ENTRYPOINT [ ]
40+
CMD [ ]

0 commit comments

Comments
 (0)