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 Show latest version
6 files
+ 28
23
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -102,13 +102,22 @@ RUN git clone --filter=tree:0 https://github.com/${EICSPACK_ORGREPO}.git ${EICSP
fi \
&& spack repo add --scope site "${EICSPACK_ROOT}"
## Setup key4hep-spack
ENV KEY4HEPSPACK_ROOT=${SPACK_ROOT}/var/spack/repos/key4hep-spack
ARG KEY4HEPSPACK_ORGREPO="key4hep/key4hep-spack"
ARG KEY4HEPSPACK_VERSION="main"
ADD https://api.github.com/repos/${KEY4HEPSPACK_ORGREPO}/commits/${KEY4HEPSPACK_VERSION} /tmp/key4hep-spack.json
RUN git clone --filter=tree:0 https://github.com/${KEY4HEPSPACK_ORGREPO}.git ${KEY4HEPSPACK_ROOT} \
&& git -C ${KEY4HEPSPACK_ROOT} checkout ${KEY4HEPSPACK_VERSION} \
&& spack repo add --scope site "${KEY4HEPSPACK_ROOT}"
## ========================================================================================
## STAGE1: builder
## EIC builder image with spack environment
## ========================================================================================
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
ENV SPACK_ENV=/opt/spack-environment/${ENV}
@@ -126,7 +135,7 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
&& ccache --show-stats \
&& ccache --zero-stats
## Setup our custom environment with custom versions (on top of cached layer)
## 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
@@ -140,11 +149,13 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
&& spack buildcache update-index eics3rw \
&& spack env activate --dir ${SPACK_ENV} \
&& if [ -n ${JUGGLER_VERSION} ] ; then \
spack rm juggler && spack add juggler@git.${JUGGLER_VERSION} ; \
spack config add "packages:juggler::require:['@git.${JUGGLER_VERSION}']" ; \
fi \
&& if [ -n ${EICRECON_VERSION} ] ; then \
spack rm eicrecon && spack add eicrecon@git.${EICRECON_VERSION} ; \
spack config add "packages:eicrecon::require:['@git.${EICRECON_VERSION}']" ; \
fi \
&& cat ${SPACK_ENV}/spack.yaml \
&& spack concretize --force --fresh \
&& make --jobs ${jobs} --keep-going --directory /opt/spack-environment \
SPACK_ENV=${SPACK_ENV} \
BUILDCACHE_MIRROR="local eics3rw" \
Loading