summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-08-14 18:02:48 +0200
committerGitHub <noreply@github.com>2023-08-14 16:02:48 +0000
commita2a52dfb2103d12e4348dec6824d4eaf68a68f58 (patch)
tree8ea1d222bd56eaad5e0a76d5e441bfcd7c6b8801 /share
parentf0ed159a1b4376e38347d9e35613716ab7684594 (diff)
downloadspack-a2a52dfb2103d12e4348dec6824d4eaf68a68f58.tar.gz
spack-a2a52dfb2103d12e4348dec6824d4eaf68a68f58.tar.bz2
spack-a2a52dfb2103d12e4348dec6824d4eaf68a68f58.tar.xz
spack-a2a52dfb2103d12e4348dec6824d4eaf68a68f58.zip
Fix containerize view symlink issue (#39419)
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