diff --git a/src/swift/.devcontainer/Dockerfile b/src/swift/.devcontainer/Dockerfile new file mode 100644 index 0000000..e30ea8d --- /dev/null +++ b/src/swift/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +ARG SWIFT_VERSION +FROM swift:${SWIFT_VERSION} + +RUN if id "ubuntu" &>/dev/null; then \ + echo "Deleting user 'ubuntu'" && userdel -f -r ubuntu || echo "Failed to delete 'ubuntu' user"; \ + fi diff --git a/src/swift/.devcontainer/devcontainer.json b/src/swift/.devcontainer/devcontainer.json index 3c09300..bf99767 100644 --- a/src/swift/.devcontainer/devcontainer.json +++ b/src/swift/.devcontainer/devcontainer.json @@ -1,12 +1,16 @@ { "name": "Swift", - "image": "swift:${templateOption:imageVariant}", + "build": { + "dockerfile": "./Dockerfile", + "context": ".", + "args": { + "SWIFT_VERSION": "${templateOption:imageVariant}" + } + }, "features": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "false", "username": "vscode", - "userUid": "1000", - "userGid": "1000", "upgradePackages": "false" }, "ghcr.io/devcontainers/features/git:1": { @@ -36,6 +40,5 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], - // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode" + "containerUser": "vscode" }