added files

This commit is contained in:
Jan Kieseler
2024-07-23 16:43:00 +02:00
parent d67b633a40
commit f1635306a0
5 changed files with 94 additions and 0 deletions
+14
View File
@@ -96,7 +96,21 @@ ADD minicalosim /root/minicalosim
RUN cd /root/minicalosim && git checkout $COMMIT && \
mkdir -p build && cd build && rm -rf * && cmake ../ && make -j4 &&\
cp minicalo* ../bind/G4Calo.py /usr/local/lib/python3.8/dist-packages/
CMD ["start-notebook.py"]
RUN cp /root/minicalosim/docker/start-notebook.py /usr/local/bin/
RUN cp /root/minicalosim/docker/start-notebook.sh /usr/local/bin/
RUN cp /root/minicalosim/docker/start-singleuser.py /usr/local/bin/
RUN cp /root/minicalosim/docker/start-singleuser.sh /usr/local/bin/
#USER root
##RUN fix-permissions /etc/jupyter/
# clean up
RUN rm -rf /root/minicalosim
#USER ${NB_UID}
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env python
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import shlex
import sys
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
if "JUPYTERHUB_API_TOKEN" in os.environ:
print(
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub."
)
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
os.execvp(command[0], command)
# Entrypoint is start.sh
command = []
# If we want to survive restarts, launch the command using `run-one-constantly`
if os.environ.get("RESTARTABLE") == "yes":
command.append("run-one-constantly")
# We always launch a jupyter subcommand from this script
command.append("jupyter")
# Launch the configured subcommand.
# Note that this should be a single string, so we don't split it.
# We default to `lab`.
jupyter_command = os.environ.get("DOCKER_STACKS_JUPYTER_CMD", "lab")
command.append(jupyter_command)
# Append any optional NOTEBOOK_ARGS we were passed in.
# This is supposed to be multiple args passed on to the notebook command,
# so we split it correctly with shlex
if "NOTEBOOK_ARGS" in os.environ:
command += shlex.split(os.environ["NOTEBOOK_ARGS"])
# Pass through any other args we were passed on the command line
command += sys.argv[1:]
# Execute the command!
print("Executing: " + " ".join(command))
os.execvp(command[0], command)
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Shim to emit warning and call start-notebook.py
echo "WARNING: Use start-notebook.py instead"
exec /usr/local/bin/start-notebook.py "$@"
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import shlex
import sys
# Entrypoint is start.sh
command = ["jupyterhub-singleuser"]
# set default ip to 0.0.0.0
if "--ip=" not in os.environ.get("NOTEBOOK_ARGS", ""):
command.append("--ip=0.0.0.0")
# Append any optional NOTEBOOK_ARGS we were passed in.
# This is supposed to be multiple args passed on to the notebook command,
# so we split it correctly with shlex
if "NOTEBOOK_ARGS" in os.environ:
command += shlex.split(os.environ["NOTEBOOK_ARGS"])
# Pass any other args we have been passed through
command += sys.argv[1:]
# Execute the command!
print("Executing: " + " ".join(command))
os.execvp(command[0], command)
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Shim to emit warning and call start-singleuser.py
echo "WARNING: Use start-singleuser.py instead"
exec /usr/local/bin/start-singleuser.py "$@"