diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile index 740f46e9ee..2f1370fdb3 100644 --- a/share/spack/templates/container/Dockerfile +++ b/share/spack/templates/container/Dockerfile @@ -7,7 +7,7 @@ RUN mkdir {{ paths.environment }} \ {{ manifest }} > {{ paths.environment }}/spack.yaml # Install the software, remove unecessary deps -RUN cd {{ paths.environment }} && spack install && spack gc -y +RUN cd {{ paths.environment }} && spack env activate . && spack install && spack gc -y {% if strip %} # Strip all the binaries diff --git a/share/spack/templates/container/singularity.def b/share/spack/templates/container/singularity.def index 616e677f96..7ba0a3ff1b 100644 --- a/share/spack/templates/container/singularity.def +++ b/share/spack/templates/container/singularity.def @@ -11,8 +11,10 @@ EOF # Install all the required software . /opt/spack/share/spack/setup-env.sh + spack env activate . spack install spack gc -y + spack env deactivate spack env activate --sh -d . >> {{ paths.environment }}/environment_modifications.sh {% if strip %} @@ -87,4 +89,4 @@ Stage: final {% for label, value in labels.items() %} {{ label }} {{ value }} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %}