blob: 33d775b024b704decca77f70d1edebef1df9c97d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
Bootstrap: docker
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
{{ manifest }}
EOF
# Install all the required software
. /opt/spack/share/spack/setup-env.sh
spack env activate .
spack install --fail-fast
spack gc -y
spack env deactivate
spack env activate --sh -d . >> {{ paths.environment }}/environment_modifications.sh
{% if strip %}
# Strip the binaries to reduce the size of the image
find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s
{% endif %}
{% if extra_instructions.build %}
{{ extra_instructions.build }}
{% endif %}
{% if apps %}
{% for application, help_text in apps.items() %}
%apprun {{ application }}
exec /opt/view/bin/{{ application }} "$@"
%apphelp {{ application }}
{{help_text }}
{% endfor %}
{% endif %}
Bootstrap: docker
From: {{ run.image }}
Stage: final
%files from build
{{ paths.environment }} /opt
{{ paths.store }} /opt
{{ paths.view }} /opt
{{ paths.environment }}/environment_modifications.sh {{ paths.environment }}/environment_modifications.sh
%post
{% 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 }}
{% endfor %}
{% endif %}
|