diff options
Diffstat (limited to 'v1')
-rw-r--r-- | v1/README.md | 2 | ||||
-rwxr-xr-x | v1/combine-feature-fragments.py | 32 | ||||
-rw-r--r-- | v1/feature-scripts.env | 23 | ||||
-rwxr-xr-x | v1/install.sh | 60 |
4 files changed, 117 insertions, 0 deletions
diff --git a/v1/README.md b/v1/README.md new file mode 100644 index 0000000..316d69f --- /dev/null +++ b/v1/README.md @@ -0,0 +1,2 @@ +Files in this folder are designed for back-compat with 'v1' +while waiting 'v2' implementation: https://github.com/devcontainers/cli/pull/6 diff --git a/v1/combine-feature-fragments.py b/v1/combine-feature-fragments.py new file mode 100755 index 0000000..bbc9913 --- /dev/null +++ b/v1/combine-feature-fragments.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# Run from repo root. + +import os + +featureDirs = os.listdir('./collection') + +beginning = """ +{ + "features": [ +""" + +middle = "" + +end = """ + ] +} +""" + +count = len(featureDirs) + +for fDir in featureDirs: + count -= 1 + config = f'./collection/{fDir}/feature.json' + data = open(config, "r").read() + middle += f'{data}' + if count != 0: + middle += ',' + middle += '\n' + +print(f'{beginning}{middle}{end}') diff --git a/v1/feature-scripts.env b/v1/feature-scripts.env new file mode 100644 index 0000000..848302b --- /dev/null +++ b/v1/feature-scripts.env @@ -0,0 +1,23 @@ +_BUILD_ARG_COMMON="./common/install.sh ${_BUILD_ARG_COMMON_INSTALLZSH} ${_BUILD_ARG_COMMON_USERNAME} ${_BUILD_ARG_COMMON_UID} ${_BUILD_ARG_COMMON_GID} ${_BUILD_ARG_COMMON_UPGRADEPACKAGES} ${_BUILD_ARG_COMMON_INSTALLOHMYZSH} ${_BUILD_ARG_COMMON_NONFREEPACKAGES}" +_BUILD_ARG_GIT="./git/install.sh ${_BUILD_ARG_GIT_VERSION:-latest} ${_BUILD_ARG_GIT_PPA:-true}" +_BUILD_ARG_GIT_LFS="./git-lfs/install.sh ${_BUILD_ARG_GIT_LFS_VERSION:-latest}" +_BUILD_ARG_DOCKER_IN_DOCKER="./docker-in-docker/install.sh true automatic ${_BUILD_ARG_DOCKER_IN_DOCKER_MOBY:-true} ${_BUILD_ARG_DOCKER_IN_DOCKER_VERSION:-latest} ${_BUILD_ARG_DOCKER_IN_DOCKER_DOCKERDASHCOMPOSEVERSION:-v1}" +_BUILD_ARG_DOCKER_FROM_DOCKER="./docker-from-docker/install.sh true /var/run/docker-host.sock /var/run/docker.sock automatic ${_BUILD_ARG_DOCKER_FROM_DOCKER_MOBY:-true} ${_BUILD_ARG_DOCKER_FROM_DOCKER_VERSION:-latest} ${_BUILD_ARG_DOCKER_FROM_DOCKER_DOCKERDASHCOMPOSEVERSION:-v1}" +_BUILD_ARG_KUBECTL_HELM_MINIKUBE="./kubectl-helm-debian/install.sh ${_BUILD_ARG_KUBECTL_HELM_MINIKUBE_VERSION:-latest} ${_BUILD_ARG_KUBECTL_HELM_MINIKUBE_HELM:-latest} ${_BUILD_ARG_KUBECTL_HELM_MINIKUBE_MINIKUBE:-latest}" +_BUILD_ARG_TERRAFORM="./terraform/install.sh ${_BUILD_ARG_TERRAFORM_VERSION:-latest} ${_BUILD_ARG_TERRAFORM_TFLINT:-latest} ${_BUILD_ARG_TERRAFORM_TERRAGRUNT:-latest}" +_BUILD_ARG_GITHUB_CLI="./github-cli/install.sh ${_BUILD_ARG_GITHUB_CLI_VERSION:-latest}" +_BUILD_ARG_AWS_CLI="./aws-cli/install.sh ${_BUILD_ARG_AWS_CLI_VERSION:-latest}" +_BUILD_ARG_AZURE_CLI="./az-cli/install.sh ${_BUILD_ARG_AZURE_CLI_VERSION:-latest}" +_BUILD_ARG_SSH="./sshd/install.sh" +_BUILD_ARG_NODE="./node/install.sh /usr/local/share/nvm ${_BUILD_ARG_NODE_VERSION:-lts/*} automatic true ${_BUILD_ARG_NODE_NODEGYPDEPENDENCIES:-true}" +_BUILD_ARG_PYTHON="./python/install.sh ${_BUILD_ARG_PYTHON_VERSION:-latest} /usr/local/python /usr/local/py-utils automatic true ${_BUILD_ARG_PYTHON_INSTALLTOOLS:-true} true ${_BUILD_ARG_PYTHON_OPTIMIZE:-false}" +_BUILD_ARG_GOLANG="./go/install.sh ${_BUILD_ARG_GOLANG_VERSION:-latest}" +_BUILD_ARG_JAVA="./java/wrapper.sh ${_BUILD_ARG_JAVA_VERSION:-latest}" +_BUILD_ARG_GRADLE="./gradle/install.sh ${_BUILD_ARG_GRADLE_VERSION:-latest}" +_BUILD_ARG_MAVEN="./maven/install.sh ${_BUILD_ARG_MAVEN_VERSION:-latest}" +_BUILD_ARG_RUBY="./ruby/install.sh ${_BUILD_ARG_RUBY_VERSION:-latest}" +_BUILD_ARG_RUST="./rust/install.sh /usr/local/cargo /usr/local/rustup automatic true false ${_BUILD_ARG_RUST_VERSION:-latest} ${_BUILD_ARG_RUST_PROFILE:-minimal}" +_BUILD_ARG_POWERSHELL="./powershell/install.sh ${_BUILD_ARG_POWERSHELL_VERSION:-latest}" +_BUILD_ARG_DESKTOP_LITE="./desktop-lite/install.sh automatic ${_BUILD_ARG_DESKTOP_LITE_PASSWORD:-vscode} true ${_BUILD_ARG_DESKTOP_LITE_VNCPORT:-5901} ${_BUILD_ARG_DESKTOP_LITE_WEBPORT:-6080}" +_BUILD_ARG_DOTNET="./dotnet/install.sh ${_BUILD_ARG_DOTNET_VERSION:-latest} ${_BUILD_ARG_DOTNET_RUNTIMEONLY:-false} automatic true /usr/local/dotnet dotnet" +_BUILD_ARG_JUPYTERLAB="./jupyterlab/install.sh ${_BUILD_ARG_JUPYTERLAB_VERSION:-latest}" diff --git a/v1/install.sh b/v1/install.sh new file mode 100755 index 0000000..758b4cd --- /dev/null +++ b/v1/install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Support 'v1' dev container feature installation +# that require a root 'install.sh' script. + +set -e +cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Verify we're on a supported OS +. /etc/os-release +if [ "${ID}" != "debian" ] && [ "${ID_LIKE}" != "debian" ]; then +cat << EOF + +*********** Unsupported operating system "${ID}" detected *********** + +Features support currently requires a Debian/Ubuntu-based image. Update your +image or Dockerfile FROM statement to start with a supported OS. For example: +mcr.microsoft.com/vscode/devcontainers/base:ubuntu + +Aborting build... + +EOF + exit 2 +fi + +set -a +. ./devcontainer-features.env +set +a + +chmod +x *.sh + +# Execute option scripts if correct environment variable is set to "true" +feature_marker_path="/usr/local/etc/vscode-dev-containers/features" +mkdir -p "${feature_marker_path}" +while IFS= read -r feature_line; do + # Extract the env var part of the line + feature_var_name="${feature_line%%=*}" + if [ ! -z "${!feature_var_name}" ]; then + # If a value is set for the env var, execute the script + feature_script_and_args="${feature_line##*=}" + feature_script_and_args="${feature_script_and_args%\"}" + script_command="$(eval echo "${feature_script_and_args#\"}")" + echo "(*) Script: ${script_command}" + + # Check if script with same args has already been run + feature_marker="${feature_marker_path}/${feature_var_name}"; + if [ -e "${feature_marker}" ] && [ "${script_command}" = "$(cat ${feature_marker})" ]; then + echo "(*) Skipping. Script already run with same arguments." + else + # Execute script and create a marker with the script args + ./${script_command} + echo "${script_command}" > "${feature_marker}" + fi + fi +done < ./feature-scripts.env + +# Clean up +apt-get autoremove -y +apt-get clean -y +rm -rf /var/lib/apt/lists/* |