summaryrefslogtreecommitdiff
path: root/share/spack/templates
diff options
context:
space:
mode:
authorJonathon Anderson <17242663+blue42u@users.noreply.github.com>2023-06-09 03:25:13 -0400
committerGitHub <noreply@github.com>2023-06-09 09:25:13 +0200
commitc354cc51d0a35f09a7d67ace71115e56154a160e (patch)
tree7fb921d1fb6dca5a9f15ebaadf53c45be96b217f /share/spack/templates
parentd5747a61e7cb6178a72ab5568bff40f4bf509638 (diff)
downloadspack-c354cc51d0a35f09a7d67ace71115e56154a160e.tar.gz
spack-c354cc51d0a35f09a7d67ace71115e56154a160e.tar.bz2
spack-c354cc51d0a35f09a7d67ace71115e56154a160e.tar.xz
spack-c354cc51d0a35f09a7d67ace71115e56154a160e.zip
containerize: use an ENTRYPOINT script (#37769)
Diffstat (limited to 'share/spack/templates')
-rw-r--r--share/spack/templates/container/Dockerfile12
1 files changed, 9 insertions, 3 deletions
diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile
index b4aee2ee78..92e89668e0 100644
--- a/share/spack/templates/container/Dockerfile
+++ b/share/spack/templates/container/Dockerfile
@@ -37,7 +37,7 @@ RUN find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \
# Modifications to the environment that are necessary to run
RUN cd {{ paths.environment }} && \
- spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
+ spack env activate --sh -d . > activate.sh
{% if extra_instructions.build %}
{{ extra_instructions.build }}
@@ -53,7 +53,13 @@ COPY --from=builder {{ paths.environment }} {{ paths.environment }}
COPY --from=builder {{ paths.store }} {{ paths.store }}
COPY --from=builder {{ paths.hidden_view }} {{ paths.hidden_view }}
COPY --from=builder {{ paths.view }} {{ paths.view }}
-COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
+
+RUN { \
+ echo '#!/bin/sh' \
+ && echo '.' {{ paths.environment }}/activate.sh \
+ && echo 'exec "$@"'; \
+ } > /entrypoint.sh \
+&& chmod a+x /entrypoint.sh
{% block final_stage %}
@@ -70,6 +76,6 @@ RUN {% if os_package_update %}{{ os_packages_final.update }} \
{% for label, value in labels.items() %}
LABEL "{{ label }}"="{{ value }}"
{% endfor %}
-ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c", "$*", "--" ]
+ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/bin/bash" ]
{% endif %}