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
5 files
+ 41
8
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -131,10 +131,6 @@ FROM spack as builder
@@ -131,10 +131,6 @@ FROM spack as builder
## Setup our custom environment (secret mount for write-enabled mirror)
## Setup our custom environment (secret mount for write-enabled mirror)
COPY --from=spack-environment . /opt/spack-environment/
COPY --from=spack-environment . /opt/spack-environment/
ARG ENV=dev
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}
ENV SPACK_ENV=/opt/spack-environment/${ENV}
RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
--mount=type=cache,target=/var/cache/spack \
--mount=type=cache,target=/var/cache/spack \
@@ -145,8 +141,31 @@ export CCACHE_DIR=/ccache
@@ -145,8 +141,31 @@ export CCACHE_DIR=/ccache
spack buildcache update-index local
spack buildcache update-index local
spack buildcache update-index eics3rw
spack buildcache update-index eics3rw
spack env activate --dir ${SPACK_ENV}
spack env activate --dir ${SPACK_ENV}
spack add juggler@git.${JUGGLER_VERSION}
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw"
spack add eicrecon@git.${EICRECON_VERSION}
ccache --show-stats
 
ccache --zero-stats
 
EOF
 
 
## Setup our custom 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 rm juggler && spack add juggler@git.${JUGGLER_VERSION}
 
fi
 
if [ -n ${EICRECON_VERSION} ] ; then
 
spack rm eicrecon && spack add eicrecon@git.${EICRECON_VERSION}
 
fi
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw"
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw"
ccache --show-stats
ccache --show-stats
ccache --zero-stats
ccache --zero-stats
Loading