From aae0e7b1d85a55ff30cd6b15cec076aa4b7df4ae Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Fri, 28 Oct 2022 09:11:36 +0100 Subject: [PATCH 1/2] Include latest changes from vscode-dev-containers --- src/swift/.devcontainer/Dockerfile | 10 +++--- src/swift/.devcontainer/devcontainer.json | 34 +++++++++---------- .../library-scripts/common-debian.sh | 6 ++-- .../library-scripts/node-debian.sh | 1 + src/swift/devcontainer-template.json | 10 +++--- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/swift/.devcontainer/Dockerfile b/src/swift/.devcontainer/Dockerfile index 9d3f20d..b4a14aa 100644 --- a/src/swift/.devcontainer/Dockerfile +++ b/src/swift/.devcontainer/Dockerfile @@ -1,11 +1,11 @@ -# [Choice] Swift version: 5.5, 5.4, 5.3, 5.2, 5.1, 4.2 -ARG VARIANT=5.5 +# [Choice] Swift version: 5.6-focal, 5.5, 5.4, 5.3, 5.2, 5.1, 4.2 +ARG VARIANT=${templateOption:imageVariant} FROM swift:${VARIANT} # [Option] Install zsh -ARG INSTALL_ZSH="true" +ARG INSTALL_ZSH="${templateOption:installZsh}" # [Option] Upgrade OS packages to their latest versions -ARG UPGRADE_PACKAGES="false" +ARG UPGRADE_PACKAGES="${templateOption:upgradePackages}" # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. ARG USERNAME=vscode @@ -17,7 +17,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" +ARG NODE_VERSION="${templateOption:nodeVersion}" ENV NVM_DIR=/usr/local/share/nvm ENV NVM_SYMLINK_CURRENT=true \ PATH=${NVM_DIR}/current/bin:${PATH} diff --git a/src/swift/.devcontainer/devcontainer.json b/src/swift/.devcontainer/devcontainer.json index 40ef7ce..724deda 100644 --- a/src/swift/.devcontainer/devcontainer.json +++ b/src/swift/.devcontainer/devcontainer.json @@ -1,13 +1,7 @@ { "name": "Swift (Community)", "build": { - "dockerfile": "Dockerfile", - "args": { - // Update the VARIANT arg to pick a Swift version - "VARIANT": "5.7", - // Options - "NODE_VERSION": "lts/*" - } + "dockerfile": "Dockerfile" }, "runArgs": [ "--cap-add=SYS_PTRACE", @@ -15,15 +9,21 @@ "seccomp=unconfined" ], - // Set *default* container specific settings.json values on container create. - "settings": { - "lldb.library": "/usr/lib/liblldb.so" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "sswg.swift-lang" - ], + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "lldb.library": "/usr/lib/liblldb.so" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "sswg.swift-lang" + ] + } + }, // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], @@ -31,6 +31,6 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "", - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" } diff --git a/src/swift/.devcontainer/library-scripts/common-debian.sh b/src/swift/.devcontainer/library-scripts/common-debian.sh index af4facc..efdca35 100755 --- a/src/swift/.devcontainer/library-scripts/common-debian.sh +++ b/src/swift/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ @@ -205,7 +205,7 @@ else fi fi -# Add add sudo support for non-root user +# Add sudo support for non-root user if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}" ]; then echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME chmod 0440 /etc/sudoers.d/$USERNAME @@ -287,7 +287,7 @@ cat << 'EOF' > /usr/local/bin/systemctl #!/bin/sh set -e if [ -d "/run/systemd/system" ]; then - exec /bin/systemctl/systemctl "$@" + exec /bin/systemctl "$@" else echo '\n"systemd" is not running in this container due to its overhead.\nUse the "service" command to start services instead. e.g.: \n\nservice --status-all' fi diff --git a/src/swift/.devcontainer/library-scripts/node-debian.sh b/src/swift/.devcontainer/library-scripts/node-debian.sh index c355168..f782961 100755 --- a/src/swift/.devcontainer/library-scripts/node-debian.sh +++ b/src/swift/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/src/swift/devcontainer-template.json b/src/swift/devcontainer-template.json index ada30c8..03a875e 100644 --- a/src/swift/devcontainer-template.json +++ b/src/swift/devcontainer-template.json @@ -36,13 +36,13 @@ "description": "Node.js version:", "proposals": [ "none", - "lts/*", + "lts", + "latest", + "18", "16", - "14", - "12", - "10" + "14" ], - "default": "lts/*" + "default": "lts" } }, "platforms": [ From 257b7d6c582bf5294124cae2248665c01d363436 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Fri, 28 Oct 2022 14:43:46 +0100 Subject: [PATCH 2/2] tabbing --- src/swift/devcontainer-template.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swift/devcontainer-template.json b/src/swift/devcontainer-template.json index 03a875e..7dd3809 100644 --- a/src/swift/devcontainer-template.json +++ b/src/swift/devcontainer-template.json @@ -37,8 +37,8 @@ "proposals": [ "none", "lts", - "latest", - "18", + "latest", + "18", "16", "14" ],