1
- # syntax=docker/dockerfile:1
1
+ # syntax=docker/dockerfile:1.3
2
2
ARG BASEIMAGE=ubuntu:22.04
3
3
4
- FROM $BASEIMAGE
4
+ FROM $BASEIMAGE AS base
5
5
6
6
ARG SPACK_VERSION=0.19.0
7
7
ARG RECIPES_BRANCH=main
@@ -30,21 +30,31 @@ ADD import_signing_key.sh /tmp
30
30
31
31
RUN --mount=type=secret,id=signingkey,uid=1000 /tmp/import_signing_key.sh /run/secrets/signingkey
32
32
33
- RUN --mount=type=cache,target=/buildcache,source=buildcache source /spack/share/spack/setup-env.sh && \
33
+ FROM base AS builder
34
+
35
+ RUN --mount=type=cache,target=/buildcache source /spack/share/spack/setup-env.sh && \
34
36
spack mirror add cache /buildcache && \
35
- spack buildcache update-index -d /buildcache
37
+ spack buildcache update-index -d /buildcache && \
38
+ spack buildcache list --allarch
39
+
40
+ # Populate cache with build tools
41
+ # Uninstall to avoid bad reuse
42
+ RUN --mount=type=cache,target=/buildcache source /spack/share/spack/setup-env.sh && \
43
+ spack env create tools --without-view && \
44
+ spack env activate tools && \
45
+ spack add cmake autotools && \
46
+ spack concretize -f && spack install --fail-fast && \
47
+ spack buildcache create -a -m cache && \
48
+ spack uninstall --all
36
49
37
50
# Define and compile an alien environment
38
- RUN --mount=type=cache,target=/home/user/buildcache,source=buildcache source /spack/share/spack/setup-env.sh && \
51
+ RUN --mount=type=cache,target=/buildcache source /spack/share/spack/setup-env.sh && \
52
+ spack buildcache update-index -d /buildcache && \
39
53
spack env create alien --without-view && \
40
54
spack env activate alien && \
41
55
spack add alien +hypre+petsc+xml+hdf5+move+ref ginkgo=omp trilinos=omp && \
42
- spack concretize -f && spack install --fail-fast
43
-
44
- RUN --mount=type=cache,target=/outcache,source=outcache source /spack/share/spack/setup-env.sh && \
45
- ls -ld /outcache && \
46
- spack env activate alien && \
47
- spack buildcache create -a -d /outcache
56
+ spack concretize -f && spack install --fail-fast && \
57
+ spack buildcache create -a -m cache
48
58
49
59
# # Define and compile an arcane environment
50
60
# RUN source /spack/share/spack/setup-env.sh && \
@@ -61,8 +71,8 @@ RUN --mount=type=cache,target=/outcache,source=outcache source /spack/share/spac
61
71
# spack add arcane ~wrapper~monoembed && \
62
72
# spack concretize -f && spack install --fail-fast
63
73
64
- RUN source /spack/share/spack/setup-env.sh && \
65
- spack clean -a
74
+ # RUN source /spack/share/spack/setup-env.sh && \
75
+ # spack clean -a
66
76
67
- USER root
68
- RUN rm -rf /tmp/* || true
77
+ FROM base AS final
78
+ COPY --from=builder /spack/opt/ /spack/
0 commit comments