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
+ 40
7
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -120,11 +120,26 @@ FROM spack as builder
@@ -120,11 +120,26 @@ 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"
ENV SPACK_ENV=/opt/spack-environment/${ENV}
 
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 \
 
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} \
 
&& make --jobs ${jobs} --keep-going --directory /opt/spack-environment \
 
SPACK_ENV=${SPACK_ENV} \
 
BUILDCACHE_MIRROR="local eics3rw" \
 
&& ccache --show-stats \
 
&& ccache --zero-stats
 
 
## 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://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
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} \
RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
--mount=type=cache,target=/var/cache/spack \
--mount=type=cache,target=/var/cache/spack \
--mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \
--mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \
@@ -133,8 +148,12 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
@@ -133,8 +148,12 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
&& 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} \
&& if [ -n ${JUGGLER_VERSION} ] ; then \
&& spack add eicrecon@git.${EICRECON_VERSION} \
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 \
&& make --jobs ${jobs} --keep-going --directory /opt/spack-environment \
SPACK_ENV=${SPACK_ENV} \
SPACK_ENV=${SPACK_ENV} \
BUILDCACHE_MIRROR="local eics3rw" \
BUILDCACHE_MIRROR="local eics3rw" \
Loading