Skip to content

Commit ce25752

Browse files
committed
access USB from devcontainer and add arch linux support
1 parent a10e014 commit ce25752

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

.devcontainer/Dockerfile

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ ARG USERNAME=vscode
66
# nodejs is required for SonarQube
77
RUN apt update \
88
&& DEBIAN_FRONTEND=noninteractive apt -y install --no-install-recommends \
9-
python3-venv \
109
nodejs \
10+
python3-venv \
1111
&& apt autopurge -y \
1212
&& apt clean -y \
13-
&& rm -rf /var/lib/apt/lists/* \
14-
&& usermod -a -G dialout $USERNAME \
15-
&& usermod -a -G plugdev $USERNAME
13+
&& rm -rf /var/lib/apt/lists/*
1614

15+
RUN mkdir -p /etc/udev/rules.d/ \
16+
&& curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules \
17+
-o /etc/udev/rules.d/99-platformio-udev.rules \
18+
&& chmod 644 /etc/udev/rules.d/99-platformio-udev.rules \
19+
&& usermod -a -G dialout $USERNAME \
20+
&& usermod -a -G plugdev $USERNAME \
21+
&& groupadd --system --gid 986 rs232 \
22+
&& usermod -a -G rs232 $USERNAME

.devcontainer/devcontainer.json

+6-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
31
{
42
"name": "C++",
5-
// specify to build docker image
63
"build": {
74
"dockerfile": "Dockerfile"
85
},
9-
// for podamn/docker compat. you must wrap docker with 'PODMAN_USERNS=keep-id podman "$@"'
106
"remoteUser": "vscode",
117
"containerUser": "vscode",
12-
// uncomment to access USB
13-
// "runArgs": [
14-
// "--privileged"
15-
// ],
16-
// "postAttachCommand": "sudo service udev restart",
17-
// // to access USB devices via /dev
18-
// "mounts": [
19-
// "source=/dev/,target=/dev/,type=bind,consistency=consistent"
20-
// ]
21-
// uncomment to display applications GUI
22-
// "containerEnv": {
23-
// "DISPLAY": ":0",
24-
// "XDG_RUNTIME_DIR": "/tmp",
25-
// "WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}"
26-
// }
8+
"runArgs": [
9+
"--privileged"
10+
],
11+
"mounts": [
12+
"source=/dev/,target=/dev/,type=bind,consistency=cached"
13+
],
2714
"customizations": {
2815
"vscode": {
2916
"extensions": [

0 commit comments

Comments
 (0)