-
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.
- Loading branch information
1 parent
db9aac0
commit 7a47d18
Showing
2 changed files
with
60 additions
and
9 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
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,54 @@ | ||
FROM intel/oneapi-hpckit:latest AS intel | ||
|
||
# Build stage with Spack pre-installed and ready to be used | ||
FROM spack/ubuntu-jammy:0.21 AS builder | ||
|
||
# Copy Intel compiler over | ||
COPY --from=intel /opt/intel/oneapi /opt/intel/oneapi | ||
|
||
# Install software from spack_intel.yaml | ||
RUN mkdir /opt/spack-environment | ||
COPY docker/spack_intel.yaml /opt/spack-environment/spack.yaml | ||
RUN cd /opt/spack-environment \ | ||
&& spack env activate . \ | ||
&& spack install --fail-fast \ | ||
&& spack gc -y | ||
|
||
# Install perl URI lib and strip all the binaries | ||
RUN apt-get update --no-cache \ | ||
&& apt-get install -y --no-install-recommends libany-uri-escape-perl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& 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:latest | ||
|
||
# Copy necessary files from the builder stage | ||
COPY --from=builder /opt/spack-environment /opt/spack-environment | ||
COPY --from=builder /opt/software /opt/software | ||
COPY --from=builder /usr /usr | ||
COPY --from=builder /opt/views /opt/views | ||
|
||
# Create entrypoint script | ||
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 \ | ||
&& apt-get update --no-cache \ | ||
&& apt-get install -y --no-install-recommends ca-certificates cpp m4 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set entrypoint and default command | ||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD [ "/bin/bash" ] |