Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/jekyll-devcontainer/src/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading