Skip to content

Commit

Permalink
feat: Add Binder support (#23)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
matthewfeickert authored Jan 9, 2023
1 parent c70139a commit b7d81d2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ test_fastjet:
--volume $(shell pwd):/work \
matthewfeickert/pythia-python:latest \
'g++ tests/test_FastJet.cc -o tests/test_FastJet $$(fastjet-config --cxxflags --libs --plugins); ./tests/test_FastJet'

binder_repo2docker:
repo2docker \
--image-name matthewfeickert/pythia-python:binder \
.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Docker Pulls](https://img.shields.io/docker/pulls/matthewfeickert/pythia-python)](https://hub.docker.com/r/matthewfeickert/pythia-python)
[![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)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/matthewfeickert/pythia-python/HEAD)

> 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.
Expand Down
40 changes: 40 additions & 0 deletions binder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM matthewfeickert/pythia-python:pythia8.308

# Remove existing non-root user "docker" with uid 1000
# to avoid conflict with jovyan
USER root
RUN deluser docker

ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}

USER root
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
USER ${NB_USER}

# FIXME: Downgrade jupyter-server to contend with:
# https://github.com/jupyterhub/repo2docker/issues/1231
# https://github.com/jupyter-server/jupyter_server/issues/1038
RUN python -m pip --no-cache-dir install --upgrade \
notebook \
jupyterlab \
jupyterhub \
'jupyter-server<2.0.0'

# Make sure the contents of the repo are in ${HOME}
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME} && \
chown -R ${NB_UID} /usr/local/venv
USER ${NB_USER}
WORKDIR ${HOME}

# Null out ENTRYPOINT and CMD to let repo2docker control them
ENTRYPOINT [ ]
CMD [ ]

0 comments on commit b7d81d2

Please sign in to comment.