diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile index ace59179725072d9265f8ae810fde00873205956..2a3e86390c412b107ca43cf5742ab4e5e79a4e54 100644 --- a/containers/jug/dev.Dockerfile +++ b/containers/jug/dev.Dockerfile @@ -104,7 +104,17 @@ RUN rm -r /usr/local \ && cd /opt/spack-environment \ && source $SPACK_ROOT/share/spack/setup-env.sh \ && spack env activate --dir /opt/spack-environment/${ENV} \ - && make -C /opt/spack-environment BUILDCACHE=/var/cache/spack-mirror + && make -C /opt/spack-environment --keep-going SPACK_ENV=${ENV} \ + BUILDCACHE_DIR=/var/cache/spack-mirror \ + BUILDCACHE_MIRROR=eic-spack + +## Optional, nuke the buildcache after install, before (re)caching +## This is useful when going to completely different containers, +## or intermittently to keep the buildcache step from taking too much time +RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked \ + cd /opt/spack-environment \ + && [ -z "${CACHE_NUKE}" ] \ + || rm -rf /var/cache/spack-mirror/build_cache/* \ ## Extra post-spack steps: ## - Python packages diff --git a/spack-environment/Makefile b/spack-environment/Makefile index da88e89929a76d451e668435b4efc6d1a5e8dec1..1a2654fd75120f0338201ff42490da1fff16fb38 100644 --- a/spack-environment/Makefile +++ b/spack-environment/Makefile @@ -7,7 +7,8 @@ export SPACK_COLOR = always SPACK_ENV ?= dev -BUILDCACHE := $(SPACK_ENV)/cache +BUILDCACHE_DIR := $(SPACK_ENV)/cache +BUILDCACHE_MIRROR := .PHONY: all clean @@ -19,7 +20,8 @@ endif $(SPACK_ENV)/push: $(addprefix $(SPACK_ENV)/push/,$($(SPACK_ENV)/SPACK_PACKAGE_IDS)) @mkdir -p $(BUILDCACHE) - $(foreach buildcache, $(BUILDCACHE), $(SPACK) buildcache update-index $(buildcache) ;) + $(foreach buildcache, $(BUILDCACHE_DIR), $(SPACK) buildcache update-index --directory $(buildcache) ;) + $(foreach buildcache, $(BUILDCACHE_MIRROR), $(SPACK) buildcache update-index --mirror-name $(buildcache) ;) $(SPACK_ENV)/push/%: $(SPACK_ENV)/install/% @mkdir -p $(dir $@)