Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 0834597

Browse files
Add support for VisualStudio Development Inside Container
1 parent 0a8edbf commit 0834597

File tree

12 files changed

+310
-0
lines changed

12 files changed

+310
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM nio-swift:5.1
2+
3+
# Or your actual UID, GID on Linux if not the default 1000
4+
ARG USERNAME=vscode
5+
ARG USER_UID=1000
6+
ARG USER_GID=$USER_UID
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Configure apt and install packages
12+
RUN apt-get update \
13+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
14+
&& groupadd --gid $USER_GID $USERNAME \
15+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
16+
# [Optional] Add sudo support for non-root user
17+
&& apt-get install -y sudo \
18+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
19+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
20+
#
21+
# Clean up
22+
&& apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Switch back to dialog for any ad-hoc use of apt-get
27+
ENV DEBIAN_FRONTEND=
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Swift",
3+
"dockerFile": "Dockerfile",
4+
5+
"runArgs": [
6+
"-u", "vscode",
7+
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
8+
],
9+
10+
"settings": {
11+
"lldb.adapterType": "bundled",
12+
"lldb.executable": "/usr/bin/lldb",
13+
"terminal.integrated.shell.linux": "/bin/bash"
14+
},
15+
16+
// Uncomment the next line if you want to publish any ports.
17+
// "appPort": [],
18+
19+
"extensions": [
20+
"pvasek.sourcekit-lsp--dev-unofficial",
21+
"vadimcn.vscode-lldb"
22+
]
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "lldb",
9+
"request": "launch",
10+
"name": "Debug",
11+
"program": "${workspaceFolder}/.build/x86_64-unknown-linux/debug/HTTPSRequest",
12+
"args": [],
13+
"cwd": "${workspaceFolder}",
14+
"preLaunchTask": "build"
15+
},
16+
{
17+
"type": "lldb",
18+
"request": "launch",
19+
"program": "${workspaceFolder}/.build/x86_64-unknown-linux/debug/HTTPSRequestPackageTests.xctest",
20+
"name": "Test",
21+
"args": [],
22+
"cwd": "${workspaceFolder}",
23+
"preLaunchTask": "test"
24+
}
25+
]
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"type": "shell",
9+
"command": "swift build",
10+
"group": {
11+
"kind": "build",
12+
"isDefault": true
13+
}
14+
},
15+
{
16+
"label": "test",
17+
"type": "shell",
18+
"command": "swift test --enable-code-coverage || true",
19+
"group": "test"
20+
},
21+
{
22+
"label": "run",
23+
"type": "shell",
24+
"command": "swift run"
25+
}
26+
]
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM nio-swift:5.1
2+
3+
# Or your actual UID, GID on Linux if not the default 1000
4+
ARG USERNAME=vscode
5+
ARG USER_UID=1000
6+
ARG USER_GID=$USER_UID
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Configure apt and install packages
12+
RUN apt-get update \
13+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
14+
&& groupadd --gid $USER_GID $USERNAME \
15+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
16+
# [Optional] Add sudo support for non-root user
17+
&& apt-get install -y sudo \
18+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
19+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
20+
#
21+
# Clean up
22+
&& apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Switch back to dialog for any ad-hoc use of apt-get
27+
ENV DEBIAN_FRONTEND=
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Swift",
3+
"dockerFile": "Dockerfile",
4+
5+
"runArgs": [
6+
"-u", "vscode",
7+
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
8+
],
9+
10+
"settings": {
11+
"lldb.adapterType": "bundled",
12+
"lldb.executable": "/usr/bin/lldb",
13+
"terminal.integrated.shell.linux": "/bin/bash"
14+
},
15+
16+
// Uncomment the next line if you want to publish any ports.
17+
// "appPort": [],
18+
19+
"extensions": [
20+
"pvasek.sourcekit-lsp--dev-unofficial",
21+
"vadimcn.vscode-lldb"
22+
]
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "lldb",
9+
"request": "launch",
10+
"name": "Debug",
11+
"program": "${workspaceFolder}/.build/x86_64-unknown-linux/debug/HelloWorld",
12+
"args": [],
13+
"cwd": "${workspaceFolder}",
14+
"preLaunchTask": "build"
15+
},
16+
{
17+
"type": "lldb",
18+
"request": "launch",
19+
"program": "${workspaceFolder}/.build/x86_64-unknown-linux/debug/HelloWorldPackageTests.xctest",
20+
"name": "Test",
21+
"args": [],
22+
"cwd": "${workspaceFolder}",
23+
"preLaunchTask": "test"
24+
}
25+
]
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"type": "shell",
9+
"command": "swift build",
10+
"group": {
11+
"kind": "build",
12+
"isDefault": true
13+
}
14+
},
15+
{
16+
"label": "test",
17+
"type": "shell",
18+
"command": "swift test --enable-code-coverage || true",
19+
"group": "test"
20+
},
21+
{
22+
"label": "run",
23+
"type": "shell",
24+
"command": "swift run"
25+
}
26+
]
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM nio-swift:5.1
2+
3+
# Or your actual UID, GID on Linux if not the default 1000
4+
ARG USERNAME=vscode
5+
ARG USER_UID=1000
6+
ARG USER_GID=$USER_UID
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Configure apt and install packages
12+
RUN apt-get update \
13+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
14+
&& groupadd --gid $USER_GID $USERNAME \
15+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
16+
# [Optional] Add sudo support for non-root user
17+
&& apt-get install -y sudo \
18+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
19+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
20+
#
21+
# Clean up
22+
&& apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Switch back to dialog for any ad-hoc use of apt-get
27+
ENV DEBIAN_FRONTEND=
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Swift",
3+
"dockerFile": "Dockerfile",
4+
5+
"runArgs": [
6+
"-u", "vscode",
7+
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
8+
],
9+
10+
"settings": {
11+
"lldb.adapterType": "bundled",
12+
"lldb.executable": "/usr/bin/lldb",
13+
"terminal.integrated.shell.linux": "/bin/bash"
14+
},
15+
16+
// Uncomment the next line if you want to publish any ports.
17+
// "appPort": [],
18+
19+
"extensions": [
20+
"pvasek.sourcekit-lsp--dev-unofficial",
21+
"vadimcn.vscode-lldb"
22+
]
23+
}

0 commit comments

Comments
 (0)