diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3903c81a..8b6c4648 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,4 @@ -ARG IMAGE_NAME=node_24_python_3_14 -ARG IMAGE_VERSION=latest -FROM ghcr.io/nhsdigital/eps-devcontainers/${IMAGE_NAME}:${IMAGE_VERSION} +FROM ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_14:v1.2.0 USER root # specify DOCKER_GID to force container docker group id to match host diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d19c9683..1c181701 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,8 +5,6 @@ "context": "..", "args": { "DOCKER_GID": "${env:DOCKER_GID:}", - "IMAGE_NAME": "node_24_python_3_14", - "IMAGE_VERSION": "v1.2.0", "USER_UID": "${localEnv:USER_ID:}", "USER_GID": "${localEnv:GROUP_ID:}" }, diff --git a/.github/workflows/get-repo-config.yml b/.github/workflows/get-repo-config.yml index cc6a9260..bf313146 100644 --- a/.github/workflows/get-repo-config.yml +++ b/.github/workflows/get-repo-config.yml @@ -51,7 +51,6 @@ jobs: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: - ref: ${{ env.BRANCH_NAME }} fetch-depth: 0 - name: Load config value @@ -60,6 +59,18 @@ jobs: TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml) DEVCONTAINER_IMAGE=$(jq -r '.build.args.IMAGE_NAME' .devcontainer/devcontainer.json) DEVCONTAINER_VERSION=$(jq -r '.build.args.IMAGE_VERSION' .devcontainer/devcontainer.json) + if [ "$DEVCONTAINER_IMAGE" == "null" ]; then + dockerfile=".devcontainer/Dockerfile" + + from_ref="$( + awk '/^FROM[[:space:]]+/ { print $2; exit }' "$dockerfile" + )" + + DEVCONTAINER_IMAGE="${from_ref##*/}" + DEVCONTAINER_IMAGE="${DEVCONTAINER_IMAGE%%:*}" + + DEVCONTAINER_VERSION="${from_ref##*:}" + fi RUNTIME_DOCKER_IMAGE="${DEVCONTAINER_IMAGE}:githubactions-${DEVCONTAINER_VERSION}" { echo "TAG_FORMAT=$TAG_FORMAT"