diff --git a/spack-flux-ubuntu-view/Dockerfile b/spack-flux-ubuntu-view/Dockerfile new file mode 100644 index 0000000..dc59eb6 --- /dev/null +++ b/spack-flux-ubuntu-view/Dockerfile @@ -0,0 +1,55 @@ +ARG tag=jammy +FROM spack/ubuntu-${tag}:latest as builder + +RUN apt-get update && apt-get install -y libntirpc-dev + +# 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: [flux-sched, flux-core, flux-security]' \ +&& 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 +FROM ubuntu:jammy + +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 + +# Ensure munge is installed and enabled. This is a design flaw +RUN apt-get update && apt-get install -y munge libntirpc-dev + +ENTRYPOINT [ "/entrypoint.sh" ] +CMD [ "/bin/bash" ] diff --git a/spack-flux-ubuntu-view/uptodate.yaml b/spack-flux-ubuntu-view/uptodate.yaml new file mode 100644 index 0000000..7e00007 --- /dev/null +++ b/spack-flux-ubuntu-view/uptodate.yaml @@ -0,0 +1,6 @@ +dockerbuild: + build_args: + tag: + key: "tag" + versions: + - "jammy"