From b85e0fd211a0f28d924a5a554e9be9d09983ca7c Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Fri, 24 Jul 2020 23:25:36 -0500 Subject: [PATCH] Added container shell wrapper to setup release container --- containers/release/Dockerfile | 4 +++- containers/release/eic-shell | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 containers/release/eic-shell diff --git a/containers/release/Dockerfile b/containers/release/Dockerfile index b19c5a58b..d37df77b7 100644 --- a/containers/release/Dockerfile +++ b/containers/release/Dockerfile @@ -26,10 +26,12 @@ COPY --from=builder /opt/view /opt/view COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh ## Setup global bashrc, useful for singularity COPY --from=builder /root/.bashrc /etc/bash.bashrc +COPY eic-shell /usr/local/bin/eic-shell +COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/eic-env.sh ## make sure we have the entrypoints setup correctly ENTRYPOINT [] CMD ["bash", "--rcfile", "/etc/profile", "-l"] USER 0 WORKDIR / -SHELL ["bash", "--rcfile", "/etc/profile"] +SHELL ["/usr/local/bin/eic-shell"] diff --git a/containers/release/eic-shell b/containers/release/eic-shell new file mode 100755 index 000000000..070f3859c --- /dev/null +++ b/containers/release/eic-shell @@ -0,0 +1,23 @@ +#! /usr/bin/env bash + +source /etc/profile + +if [ -p /dev/stdin ]; then + # If we want to read the input line by line + while IFS= read line; do + if [ -z "$piped_args" ]; then + piped_args="${line}" + else + piped_args="${piped_args}\n${line}" + fi + done +fi + +## Fire off bash +if [ ${piped_args} ] ; then + echo -e ${piped_args} | exec bash +elif [ $# -gt 0 ]; then + exec bash -c "$@" +else + exec bash +fi -- GitLab