Skip to content
Snippets Groups Projects

feat: install most dependencies in cacheable layer, before adding main

Merged Wouter Deconinck requested to merge cacheable-layer into master
Compare and
5 files
+ 43
9
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -129,13 +129,9 @@ EOF
## ========================================================================================
FROM spack as builder
## Setup our custom environment (secret mount for write-enabled mirror)
## 1. Setup our default environment (secret mount for write-enabled mirror)
COPY --from=spack-environment . /opt/spack-environment/
ARG ENV=dev
ARG JUGGLER_VERSION="main"
ADD https://eicweb.phy.anl.gov/api/v4/projects/EIC%2Fjuggler/repository/tree?ref=${JUGGLER_VERSION} /tmp/juggler.json
ARG EICRECON_VERSION="main"
ADD https://api.github.com/repos/eic/eicrecon/commits/${EICRECON_VERSION} /tmp/eicrecon.json
ENV SPACK_ENV=/opt/spack-environment/${ENV}
RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
--mount=type=cache,target=/var/cache/spack \
@@ -146,8 +142,32 @@ export CCACHE_DIR=/ccache
spack buildcache update-index local
spack buildcache update-index eics3rw
spack env activate --dir ${SPACK_ENV}
spack add juggler@git.${JUGGLER_VERSION}
spack add eicrecon@git.${EICRECON_VERSION}
spack concretize --fresh --force --quiet
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw"
ccache --show-stats
ccache --zero-stats
EOF
## 2. Setup our environment with custom versions (on top of cached layer)
ARG JUGGLER_VERSION=""
ARG EICRECON_VERSION=""
ADD https://eicweb.phy.anl.gov/api/v4/projects/EIC%2Fjuggler/repository/tree?ref=${JUGGLER_VERSION} /tmp/juggler.json
ADD https://api.github.com/repos/eic/eicrecon/commits/${EICRECON_VERSION} /tmp/eicrecon.json
RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
--mount=type=cache,target=/var/cache/spack \
--mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \
<<EOF
source $SPACK_ROOT/share/spack/setup-env.sh
export CCACHE_DIR=/ccache
spack buildcache update-index local
spack buildcache update-index eics3rw
spack env activate --dir ${SPACK_ENV}
if [ -n ${JUGGLER_VERSION} ] ; then
spack config add "packages:juggler::require:['@git.${JUGGLER_VERSION}']"
fi
if [ -n ${EICRECON_VERSION} ] ; then
spack config add "packages:eicrecon::require:['@git.${EICRECON_VERSION}']"
fi
spack concretize --fresh --force --quiet
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw"
ccache --show-stats
Loading