Skip to content

Commit a1290ce

Browse files
committed
Add VS Code container
1 parent 01d745d commit a1290ce

File tree

5 files changed

+703
-0
lines changed

5 files changed

+703
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# [Choice] Swift version: 5.6-focal, 5.5, 5.4, 5.3, 5.2, 5.1, 4.2
2+
ARG VARIANT=5.7.1-jammy
3+
FROM swift:${VARIANT}
4+
5+
# [Option] Install zsh
6+
ARG INSTALL_ZSH="true"
7+
# [Option] Upgrade OS packages to their latest versions
8+
ARG UPGRADE_PACKAGES="false"
9+
10+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
11+
ARG USERNAME=vscode
12+
ARG USER_UID=1000
13+
ARG USER_GID=$USER_UID
14+
COPY library-scripts/common-debian.sh /tmp/library-scripts/
15+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
16+
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
17+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
18+
19+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
20+
ARG NODE_VERSION="none"
21+
ENV NVM_DIR=/usr/local/share/nvm
22+
ENV NVM_SYMLINK_CURRENT=true \
23+
PATH=${NVM_DIR}/current/bin:${PATH}
24+
COPY library-scripts/node-debian.sh /tmp/library-scripts/
25+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
26+
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
27+
28+
# [Optional] Uncomment this section to install additional OS packages you may want.
29+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
30+
# && apt-get -y install --no-install-recommends <your-package-list-here>
31+
32+
# [Optional] Uncomment this line to install global node packages.
33+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/swift
3+
{
4+
"name": "Swift",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update the VARIANT arg to pick a Swift version
9+
"VARIANT": "5.7.1-jammy",
10+
// Options
11+
"NODE_VERSION": "lts/*",
12+
"UPGRADE_PACKAGES": "true"
13+
}
14+
},
15+
"runArgs": [
16+
"--cap-add=SYS_PTRACE",
17+
"--security-opt",
18+
"seccomp=unconfined"
19+
],
20+
21+
// Configure tool-specific properties.
22+
"customizations": {
23+
// Configure properties specific to VS Code.
24+
"vscode": {
25+
// Set *default* container specific settings.json values on container create.
26+
"settings": {
27+
"lldb.library": "/usr/lib/liblldb.so"
28+
},
29+
30+
// Add the IDs of extensions you want installed when the container is created.
31+
"extensions": [
32+
"sswg.swift-lang"
33+
]
34+
}
35+
},
36+
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
// "forwardPorts": [],
39+
40+
// Use 'postCreateCommand' to run commands after the container is created.
41+
// "postCreateCommand": "",
42+
43+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
45+
}

0 commit comments

Comments
 (0)