Skip to content

Instantly share code, notes, and snippets.

@vdikan
Created May 2, 2021 16:32
Show Gist options
  • Save vdikan/9dac511f6c8a21cc3f734209d4fd9ac0 to your computer and use it in GitHub Desktop.
Save vdikan/9dac511f6c8a21cc3f734209d4fd9ac0 to your computer and use it in GitHub Desktop.
Siesta spacked distribution Dockerfile
FROM vdikan/siesta-spack: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:" \
&& echo " - siesta+libxc ^[email protected]" \
&& echo " - atom-dft ^[email protected]" \
&& echo " view: /opt/view" \
&& echo " concretization: together" \
&& 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/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
# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment && \
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
# Bare OS image to run the installed executables
FROM ubuntu:18.04
COPY --from=builder /opt/spack-environment /opt/spack-environment
COPY --from=builder /opt/software /opt/software
COPY --from=builder /opt/view /opt/view
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends \
curl \
gfortran \
make \
ssh \
vim \
nano \
locales \
&& locale-gen en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment