-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prepare to add hwloc sniffer as a metric!
Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ARG tag=jammy | ||
FROM spack/ubuntu-${tag}:latest as builder | ||
|
||
# What we want to install and how we want to install it | ||
# is specified in a manifest file (spack.yaml) | ||
RUN mkdir /opt/spack-environment \ | ||
&& (echo spack: \ | ||
&& echo ' specs: [hwloc+cairo]' \ | ||
&& echo ' view: /opt/views/view' \ | ||
&& echo ' concretizer:' \ | ||
&& echo ' unify: true' \ | ||
&& echo ' packages:' \ | ||
&& echo ' all:' \ | ||
&& echo ' require: ["target=:x86_64"]' \ | ||
&& echo ' config:' \ | ||
&& echo ' install_tree: /opt/software') > /opt/spack-environment/spack.yaml | ||
|
||
# Install the software, remove unnecessary deps | ||
RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y | ||
|
||
# Strip all the binaries | ||
RUN find -L /opt/views/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 | ||
|
||
# Modifications to the environment that are necessary to run | ||
RUN cd /opt/spack-environment && \ | ||
spack env activate --sh -d . > activate.sh | ||
|
||
# Bare OS image to run the installed executables | ||
ARG tag=jammy | ||
FROM ubuntu:${tag} | ||
|
||
COPY --from=builder /opt/spack-environment /opt/spack-environment | ||
COPY --from=builder /opt/software /opt/software | ||
|
||
# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it | ||
COPY --from=builder /opt/views /opt/views | ||
|
||
RUN { \ | ||
echo '#!/bin/sh' \ | ||
&& echo '.' /opt/spack-environment/activate.sh \ | ||
&& echo 'exec "$@"'; \ | ||
} > /entrypoint.sh \ | ||
&& chmod a+x /entrypoint.sh \ | ||
&& ln -s /opt/views/view /opt/view | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD [ "/bin/bash" ] |