summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/container/Dockerfile20
-rw-r--r--share/spack/templates/container/singularity.def34
2 files changed, 35 insertions, 19 deletions
diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile
index c65fce5627..3623a7ba0b 100644
--- a/share/spack/templates/container/Dockerfile
+++ b/share/spack/templates/container/Dockerfile
@@ -1,12 +1,19 @@
# Build stage with Spack pre-installed and ready to be used
-FROM {{ build.image }}:{{ build.tag }} as builder
+FROM {{ build.image }} as builder
+
+{% if os_packages_build %}
+# Install OS packages needed to build the software
+RUN {% if os_package_update %}{{ os_packages_build.update }} \
+ && {% endif %}{{ os_packages_build.install }} {{ os_packages_build.list | join | replace('\n', ' ') }} \
+ && {{ os_packages_build.clean }}
+{% endif %}
# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir {{ paths.environment }} \
{{ manifest }} > {{ paths.environment }}/spack.yaml
-# Install the software, remove unecessary deps
+# Install the software, remove unnecessary deps
RUN cd {{ paths.environment }} && spack env activate . && spack install --fail-fast && spack gc -y
{% if strip %}
@@ -34,16 +41,15 @@ COPY --from=builder {{ paths.store }} {{ paths.store }}
COPY --from=builder {{ paths.view }} {{ paths.view }}
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
-{% if os_packages %}
-RUN {{ os_packages.update }} \
- && {{ os_packages.install }}{% for pkg in os_packages.list %} {{ pkg }}{% endfor %} \
- && {{ os_packages.clean }}
+{% if os_packages_final %}
+RUN {% if os_package_update %}{{ os_packages_final.update }} \
+ && {% endif %}{{ os_packages_final.install }} {{ os_packages_final.list | join | replace('\n', ' ') }} \
+ && {{ os_packages_final.clean }}
{% endif %}
{% if extra_instructions.final %}
{{ extra_instructions.final }}
{% endif %}
-
{% for label, value in labels.items() %}
LABEL "{{ label }}"="{{ value }}"
{% endfor %}
diff --git a/share/spack/templates/container/singularity.def b/share/spack/templates/container/singularity.def
index 44b22aeae6..33d775b024 100644
--- a/share/spack/templates/container/singularity.def
+++ b/share/spack/templates/container/singularity.def
@@ -1,8 +1,17 @@
Bootstrap: docker
-From: {{ build.image }}:{{ build.tag }}
+From: {{ build.image }}
Stage: build
%post
+{% if os_packages_build.list %}
+ # Update, install and cleanup of system packages needed at build-time
+ {% if os_package_update %}
+ {{ os_packages_build.update }}
+ {% endif %}
+ {{ os_packages_build.install }} {{ os_packages_build.list | join | replace('\n', ' ') }}
+ {{ os_packages_build.clean }}
+
+{% endif %}
# Create the manifest file for the installation in /opt/spack-environment
mkdir {{ paths.environment }} && cd {{ paths.environment }}
cat << EOF > spack.yaml
@@ -29,7 +38,6 @@ EOF
{{ extra_instructions.build }}
{% endif %}
-
{% if apps %}
{% for application, help_text in apps.items() %}
@@ -52,39 +60,41 @@ Stage: final
{{ paths.environment }}/environment_modifications.sh {{ paths.environment }}/environment_modifications.sh
%post
-{% if os_packages.list %}
- # Update, install and cleanup of system packages
- {{ os_packages.update }}
- {{ os_packages.install }} {{ os_packages.list | join | replace('\n', ' ') }}
- {{ os_packages.clean }}
+{% if os_packages_final.list %}
+ # Update, install and cleanup of system packages needed at run-time
+ {% if os_package_update %}
+ {{ os_packages_final.update }}
+ {% endif %}
+ {{ os_packages_final.install }} {{ os_packages_final.list | join | replace('\n', ' ') }}
+ {{ os_packages_final.clean }}
{% endif %}
# Modify the environment without relying on sourcing shell specific files at startup
cat {{ paths.environment }}/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
{% if extra_instructions.final %}
{{ extra_instructions.final }}
{% endif %}
-
{% if runscript %}
+
%runscript
{{ runscript }}
{% endif %}
-
{% if startscript %}
+
%startscript
{{ startscript }}
{% endif %}
-
{% if test %}
+
%test
{{ test }}
{% endif %}
-
{% if help %}
+
%help
{{ help }}
{% endif %}
-
{% if labels %}
+
%labels
{% for label, value in labels.items() %}
{{ label }} {{ value }}