first round of changes: dedicated cache folder, cleaner base image, version management
This commit is contained in:
@ -1,15 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Installs gems, but only when Gemfile.lock has changed: it remembers the last
|
||||
# version it installed (saved between runs), so an unchanged lockfile is a
|
||||
# near-instant no-op.
|
||||
# version it installed, so an unchanged lockfile is a near-instant no-op.
|
||||
#
|
||||
# Both the gems (via BUNDLE_PATH, set in the Dockerfile) and the marker below
|
||||
# live in /code/.safeclaude/cache — on the host, so they persist between runs
|
||||
# and stay out of git. Ruby is already on PATH from the Dockerfile, so there's
|
||||
# no version manager to initialize here.
|
||||
set -euo pipefail
|
||||
|
||||
[ -f /code/Gemfile ] || exit 0
|
||||
eval "$(rbenv init - bash)"
|
||||
|
||||
CACHE=/code/.safeclaude/cache
|
||||
mkdir -p "$CACHE"
|
||||
LOCK=/code/Gemfile.lock
|
||||
MARKER="$HOME/.safeclaude-deps/gemfile.sha"
|
||||
mkdir -p "$(dirname "$MARKER")"
|
||||
MARKER="$CACHE/gemfile.sha"
|
||||
CUR="$( [ -f "$LOCK" ] && sha256sum "$LOCK" | cut -d' ' -f1 || echo no-lock )"
|
||||
|
||||
if [ "$(cat "$MARKER" 2>/dev/null || true)" != "$CUR" ]; then
|
||||
|
||||
Reference in New Issue
Block a user