chore: use persistent Docker volume for stack-root instead of host directory
Build and Deploy / build-and-deploy (push) Successful in 1m36s
Build and Deploy / build-and-deploy (push) Successful in 1m36s
This allows all git worktrees to share a single cached GHC and dependency store, avoiding recompilation per worktree.
This commit is contained in:
@@ -6,13 +6,17 @@ set -euo pipefail
|
|||||||
|
|
||||||
IMAGE="${HAWAT_HASKELL_TOOLS_IMAGE:-ghcr.io/flipstone/haskell-tools:debian-ghc-9.10.3-5d6640d}"
|
IMAGE="${HAWAT_HASKELL_TOOLS_IMAGE:-ghcr.io/flipstone/haskell-tools:debian-ghc-9.10.3-5d6640d}"
|
||||||
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
STACK_ROOT_HOST="${PROJECT_DIR}/.stack-root"
|
|
||||||
|
|
||||||
mkdir -p "${STACK_ROOT_HOST}"
|
# Named Docker volume shared across all worktrees so cached
|
||||||
|
# GHC/dependencies don't need rebuilding per worktree.
|
||||||
|
STACK_ROOT_VOLUME="roux-stack-root"
|
||||||
|
|
||||||
|
docker volume inspect "${STACK_ROOT_VOLUME}" > /dev/null 2>&1 || \
|
||||||
|
docker volume create "${STACK_ROOT_VOLUME}" > /dev/null
|
||||||
|
|
||||||
exec docker run --rm -i $([ -t 0 ] && printf -- -t) \
|
exec docker run --rm -i $([ -t 0 ] && printf -- -t) \
|
||||||
-v "${PROJECT_DIR}:/work" \
|
-v "${PROJECT_DIR}:/work" \
|
||||||
-v "${STACK_ROOT_HOST}:/stack-root" \
|
-v "${STACK_ROOT_VOLUME}:/stack-root" \
|
||||||
-e STACK_ROOT=/stack-root \
|
-e STACK_ROOT=/stack-root \
|
||||||
-w /work \
|
-w /work \
|
||||||
"${IMAGE}" \
|
"${IMAGE}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user