summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/container/Dockerfile8
-rw-r--r--share/spack/templates/container/singularity.def9
2 files changed, 11 insertions, 6 deletions
diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile
index 92e89668e0..27c2dbf5cf 100644
--- a/share/spack/templates/container/Dockerfile
+++ b/share/spack/templates/container/Dockerfile
@@ -51,15 +51,17 @@ FROM {{ run.image }}
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 }}
+
+# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it
+COPY --from=builder {{ paths.view_parent }} {{ paths.view_parent }}
RUN { \
echo '#!/bin/sh' \
&& echo '.' {{ paths.environment }}/activate.sh \
&& echo 'exec "$@"'; \
} > /entrypoint.sh \
-&& chmod a+x /entrypoint.sh
+&& chmod a+x /entrypoint.sh \
+&& ln -s {{ paths.view }} {{ paths.former_view }}
{% block final_stage %}
diff --git a/share/spack/templates/container/singularity.def b/share/spack/templates/container/singularity.def
index a67d25783d..4184db92b6 100644
--- a/share/spack/templates/container/singularity.def
+++ b/share/spack/templates/container/singularity.def
@@ -47,7 +47,7 @@ EOF
{% for application, help_text in apps.items() %}
%apprun {{ application }}
- exec /opt/view/bin/{{ application }} "$@"
+ exec {{ paths.view }}/bin/{{ application }} "$@"
%apphelp {{ application }}
{{help_text }}
@@ -61,11 +61,14 @@ Stage: final
%files from build
{{ paths.environment }} /opt
{{ paths.store }} /opt
- {{ paths.hidden_view }} /opt
- {{ paths.view }} /opt
+ {{ paths.view_parent }} /opt
{{ paths.environment }}/environment_modifications.sh {{ paths.environment }}/environment_modifications.sh
%post
+
+ # Symlink the old view location
+ ln -s {{ paths.view }} {{ paths.former_view }}
+
{% block final_stage %}
{% if os_packages_final.list %}
# Update, install and cleanup of system packages needed at run-time