Skip to content

Commit 705bd42

Browse files
committed
Rewrite ghcr.io in devcontainer features to use the pull through cache
1 parent cb132c0 commit 705bd42

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

startupscript/butane/005-parse-devcontainer.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ if [[ -d "${DEVCONTAINER_FEATURES_PATH}" ]]; then
7878
rsync -a --ignore-existing "${DEVCONTAINER_FEATURES_PATH}/" "${DEVCONTAINER_PATH}/.devcontainer/features"
7979
fi
8080

81+
# Rewrite ghcr.io references to use the GAR pull-through cache
82+
readonly GHCR_CACHE="us-central1-docker.pkg.dev/workbench-app-cache/ghcr-cache"
83+
sed -i "s|ghcr\.io/|${GHCR_CACHE}/|g" "${DEVCONTAINER_CONFIG_PATH}"
84+
find "${DEVCONTAINER_PATH}/.devcontainer/features" -name devcontainer-feature.json -exec sed -i "s|ghcr\.io/|${GHCR_CACHE}/|g" {} +
85+
8186
replace_template_options() {
8287
local TEMPLATE_PATH="$1"
8388

0 commit comments

Comments
 (0)