From b337561bbdc20b3c8be68cf164ff7328b33e08d7 Mon Sep 17 00:00:00 2001 From: aidenvaines-cgi Date: Tue, 14 Jul 2026 09:03:00 +0100 Subject: [PATCH] CCM-18536 adding ASDF packages --- src/jekyll-devcontainer/src/.devcontainer/Dockerfile | 8 ++++---- .../src/.devcontainer/nhsnotify/install.sh | 8 +++++++- .../src/.devcontainer/nhsnotify/postcreatecommand.sh | 7 ++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/jekyll-devcontainer/src/.devcontainer/Dockerfile b/src/jekyll-devcontainer/src/.devcontainer/Dockerfile index 3ad5dc2..3e2c6b1 100644 --- a/src/jekyll-devcontainer/src/.devcontainer/Dockerfile +++ b/src/jekyll-devcontainer/src/.devcontainer/Dockerfile @@ -2,6 +2,7 @@ FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/jekyll:3.4-bookworm LABEL org.opencontainers.image.source=https://github.com/NHSDigital/nhs-notify-web-cms ENV ASDF_DIR=/.asdf +ENV ASDF_DATA_DIR=/.asdf ENV PATH=${ASDF_DIR}/bin:${ASDF_DIR}/shims:${PATH} COPY packages.txt packages.txt @@ -11,8 +12,7 @@ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive xargs apt-get -yq install < packages.txt RUN git clone https://github.com/asdf-vm/asdf.git ${ASDF_DIR} --branch v0.18.0 \ - && . ${ASDF_DIR}/asdf.sh \ - && awk '/^[a-zA-Z0-9_-]+[[:space:]]+/{print $1}' .tool-versions | while read -r plugin; do asdf plugin add "$plugin" || true; done \ - && asdf install \ - && asdf reshim \ + && awk '/^[a-zA-Z0-9_-]+[[:space:]]+/{print $1}' .tool-versions | while read -r plugin; do ${ASDF_DIR}/bin/asdf plugin add "$plugin" || true; done \ + && ${ASDF_DIR}/bin/asdf install \ + && ${ASDF_DIR}/bin/asdf reshim \ && rm -f .tool-versions diff --git a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh index c0a5ad4..3cec590 100755 --- a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh +++ b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh @@ -7,7 +7,13 @@ if [[ ! -d /.asdf ]]; then git clone https://github.com/asdf-vm/asdf.git /.asdf --branch v0.18.0 fi -grep -qxF '. /.asdf/completions/asdf.bash' /.zshrc || echo '. /.asdf/completions/asdf.bash' >> /.zshrc +# Remove any existing home-based asdf init lines to avoid switching to /home/vscode/.asdf. +sed -i "/\. '\$HOME\/.asdf\/completions\/asdf.bash'/d" /.zshrc +sed -i '/\. \/\.asdf\/completions\/asdf.bash/d' /.zshrc + +grep -qxF 'export ASDF_DIR=/.asdf' /.zshrc || echo 'export ASDF_DIR=/.asdf' >> /.zshrc +grep -qxF 'export ASDF_DATA_DIR=/.asdf' /.zshrc || echo 'export ASDF_DATA_DIR=/.asdf' >> /.zshrc +grep -qxF 'export PATH=/.asdf/bin:/.asdf/shims:$PATH' /.zshrc || echo 'export PATH=/.asdf/bin:/.asdf/shims:$PATH' >> /.zshrc sed -i "/plugins=/c\plugins=(git ssh-agent sudo terraform dirhistory zsh-autosuggestions)" /.zshrc cat /.zshrc diff --git a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh index 2807fcc..5b30b79 100755 --- a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh +++ b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh @@ -8,12 +8,13 @@ cat ~/.zshrc source ~/.zshrc export ASDF_DIR=/.asdf -. "$ASDF_DIR/asdf.sh" +export ASDF_DATA_DIR=/.asdf export PATH="$ASDF_DIR/shims:$ASDF_DIR/bin:$PATH" +ASDF_BIN="$ASDF_DIR/bin/asdf" # Install tools pinned in .tool-versions so runtime versions are consistent. -asdf install -asdf reshim +$ASDF_BIN install +$ASDF_BIN reshim hash -r # Rehash shims so that the new versions are used echo 'asdf setup complete'