From 7c27d2940ea43c59d7836378fc944f6dd9f3d480 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 5 Aug 2025 22:26:20 +0000 Subject: [PATCH] Install bazel version required by the repo S-CORE is sadly not a monorepo and each repo may use a different bazel version. Instead of preinstalling all of them the chosen bazel version is installed, when the container is created. This keeps the image smaller and can adapt better to changes in the repo. --- .../.devcontainer/s-core-local/devcontainer-feature.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/devcontainer-feature.json b/src/s-core-devcontainer/.devcontainer/s-core-local/devcontainer-feature.json index 258723d..dc88510 100644 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/devcontainer-feature.json +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/devcontainer-feature.json @@ -31,10 +31,13 @@ } }, "onCreateCommand": "/devcontainer/features/s-core-local/on_create_command.sh", - "mounts": [ { + // The repos in S-CORE may use different Bazel versions. This ensures that the required version is installed + "postCreateCommand": "if [ -f .bazelversion ]; then sudo apt update && sudo apt install bazel-$(cat .bazelversion); fi", + "mounts": [ + { "source": "${localEnv:HOME}/.cache/bazel", // default Bazel cache directory "target": "/var/cache/bazel", "type": "bind" } - ] + ] }