From a06198d00cd58c4fc6b706fdd5d0136bd29af6af Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 19 Dec 2023 17:23:52 -0600 Subject: [PATCH 1/4] feat: Add entrypoint and tini --- docker/Dockerfile | 11 ++++++++++- docker/cmd.sh | 2 -- docker/entrypoint.sh | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docker/entrypoint.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index a4a4e7f..ad8df55 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,12 +11,18 @@ RUN yum install -y \ graphviz && \ yum clean all +# Add Tini +ENV TINI_VERSION=v0.19.0 +ADD --chown=atlas https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini + COPY --chown=atlas docker/requirements.txt /docker/ COPY --chown=atlas docker/requirements.lock /docker/ COPY --chown=atlas analysis /analysis WORKDIR /analysis COPY --chown=atlas /docker/cmd.sh /cmd.sh +COPY --chown=atlas /docker/entrypoint.sh /entrypoint.sh RUN echo -e '\n# Activate python virtual environment\nif [ -d /venv/bin ]; then\n . /venv/bin/activate\nfi' >> /release_setup.sh && \ bash <(curl -sL https://raw.githubusercontent.com/matthewfeickert/cvmfs-venv/v0.0.5/cvmfs-venv.sh) /venv && \ @@ -33,7 +39,8 @@ RUN echo -e '\n# Activate python virtual environment\nif [ -d /venv/bin ]; then\ python -m pip list && \ root --version -RUN chmod +x /release_setup.sh +RUN chmod +x /entrypoint.sh && \ + chmod +x /release_setup.sh # Need to use an additonal directory beyond /usr/AnalysisBase to install # given how ATLAS CMake works. @@ -76,4 +83,6 @@ RUN echo -e '\n# Activate AnalysisBase environment on login shell\n. /release_se # $(jupyter --config) should be /home/atlas/.jupyter/ COPY --chown=atlas docker/jupyter_lab_config.py /home/atlas/.jupyter/ +ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"] + CMD [ "/cmd.sh" ] diff --git a/docker/cmd.sh b/docker/cmd.sh index 5b3380d..ea37c1d 100755 --- a/docker/cmd.sh +++ b/docker/cmd.sh @@ -1,5 +1,3 @@ #!/bin/bash -. /release_setup.sh - jupyter lab --no-browser --ip 0.0.0.0 --port 8888 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..c964c92 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +. /release_setup.sh + +# Run extra commands +exec "$@" From aca05f33555dac8e606b917b8de859cdba884c28 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 19 Dec 2023 17:26:06 -0600 Subject: [PATCH 2/4] chmod +x everything --- docker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ad8df55..c145734 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,6 @@ RUN yum install -y \ # Add Tini ENV TINI_VERSION=v0.19.0 ADD --chown=atlas https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini COPY --chown=atlas docker/requirements.txt /docker/ COPY --chown=atlas docker/requirements.lock /docker/ @@ -39,7 +38,9 @@ RUN echo -e '\n# Activate python virtual environment\nif [ -d /venv/bin ]; then\ python -m pip list && \ root --version -RUN chmod +x /entrypoint.sh && \ +RUN chmod +x /tini && \ + chmod +x /entrypoint.sh && \ + chmod +x /cmd.sh && \ chmod +x /release_setup.sh # Need to use an additonal directory beyond /usr/AnalysisBase to install From 97f6817224d99a4774056a4cb44d279917366326 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 19 Dec 2023 17:46:45 -0600 Subject: [PATCH 3/4] use absolute path as not globally installed --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c145734..c9046cd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -84,6 +84,6 @@ RUN echo -e '\n# Activate AnalysisBase environment on login shell\n. /release_se # $(jupyter --config) should be /home/atlas/.jupyter/ COPY --chown=atlas docker/jupyter_lab_config.py /home/atlas/.jupyter/ -ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"] +ENTRYPOINT ["/tini", "-g", "--", "/entrypoint.sh"] CMD [ "/cmd.sh" ] From ce2e363f6dfb517806fe03bda00ac64256fd3bcd Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 19 Dec 2023 19:59:34 -0600 Subject: [PATCH 4/4] switch ordre for clarity --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c9046cd..95ae9e6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,8 +20,8 @@ COPY --chown=atlas docker/requirements.lock /docker/ COPY --chown=atlas analysis /analysis WORKDIR /analysis -COPY --chown=atlas /docker/cmd.sh /cmd.sh COPY --chown=atlas /docker/entrypoint.sh /entrypoint.sh +COPY --chown=atlas /docker/cmd.sh /cmd.sh RUN echo -e '\n# Activate python virtual environment\nif [ -d /venv/bin ]; then\n . /venv/bin/activate\nfi' >> /release_setup.sh && \ bash <(curl -sL https://raw.githubusercontent.com/matthewfeickert/cvmfs-venv/v0.0.5/cvmfs-venv.sh) /venv && \