-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (44 loc) · 1.61 KB
/
Dockerfile
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
# Build stage with Spack pre-installed and ready to be used
FROM spack/ubuntu-jammy:0.21 AS builder
# Install software from spack_devenv.yaml
RUN mkdir /opt/spack-environment
COPY spack.yaml /opt/spack-environment/spack.yaml
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
# Copy and compile domain_decomp
COPY . /decomp
RUN spack env activate /opt/spack-environment \
&& cd /decomp \
&& BUILD_DIR=`mktemp -d` \
&& cmake -G "Unix Makefiles" -B$BUILD_DIR -S. \
&& cmake --build $BUILD_DIR --config Release \
&& cp $BUILD_DIR/decomp /usr/bin/
# Bare OS image to run the installed executables
FROM ubuntu:22.04
# 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 /decomp /decomp
COPY --from=builder /usr /usr
# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it
COPY --from=builder /opt/views /opt/views
RUN ln -s /opt/views/view /opt/view
# Copy and set entrypoint
COPY entrypoint.sh /
RUN chmod a+x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
# Set volume mount point for I/O
RUN mkdir /io
VOLUME /io
WORKDIR /io