Skip to content

Commit 4b03ce1

Browse files
committed
tooling: Improve devcontainer with USB, zsh, and serial support.
1 parent 9dbe0fa commit 4b03ce1

2 files changed

Lines changed: 85 additions & 34 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openocd \
88
&& rm -rf /var/lib/apt/lists/*
99

10-
# Node.js 20 (for husky, commitlint, lint-staged, semantic-release)
11-
ARG NODE_VERSION=20
12-
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
13-
&& apt-get install -y --no-install-recommends nodejs \
14-
&& rm -rf /var/lib/apt/lists/*
15-
16-
# GitHub CLI
17-
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
18-
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
19-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
20-
> /etc/apt/sources.list.d/github-cli.list \
21-
&& apt-get update && apt-get install -y --no-install-recommends gh \
22-
&& rm -rf /var/lib/apt/lists/*
10+
# udev rules for STeaMi board (DAPLink / STM32)
11+
RUN echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0666"' \
12+
> /etc/udev/rules.d/99-steami.rules

.devcontainer/devcontainer.json

Lines changed: 82 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,85 @@
11
{
2-
"name": "STeaMi MicroPython Dev",
3-
"build": {
4-
"dockerfile": "Dockerfile"
5-
},
6-
"postCreateCommand": "make setup",
7-
"customizations": {
8-
"vscode": {
9-
"extensions": [
10-
"charliermarsh.ruff",
11-
"ms-python.python"
12-
],
13-
"settings": {
14-
"python.defaultInterpreterPath": "/usr/local/bin/python",
15-
"python.testing.pytestEnabled": true,
16-
"python.testing.pytestArgs": ["-v", "-k", "mock"],
17-
"editor.formatOnSave": true,
18-
"[python]": {
19-
"editor.defaultFormatter": "charliermarsh.ruff"
2+
"name": "STeaMi MicroPython Dev",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
7+
// USB access for STeaMi board (DAPLink / mpremote / OpenOCD)
8+
"privileged": true,
9+
"mounts": ["type=bind,source=/dev/bus/usb,target=/dev/bus/usb"],
10+
"runArgs": ["--device=/dev/bus/usb"],
11+
12+
"features": {
13+
"ghcr.io/devcontainers/features/node:1": {
14+
"version": "20"
15+
},
16+
"ghcr.io/devcontainers/features/common-utils:2": {
17+
"installZsh": true,
18+
"installOhMyZsh": true,
19+
"upgradePackages": true,
20+
"username": "vscode"
21+
},
22+
"ghcr.io/devcontainers/features/github-cli:1": {},
23+
"ghcr.io/devcontainers-extra/features/shell-history:0": {}
24+
},
25+
26+
"customizations": {
27+
"vscode": {
28+
"settings": {
29+
"terminal.integrated.profiles.linux": {
30+
"zsh": {
31+
"path": "zsh"
32+
}
33+
},
34+
"terminal.integrated.defaultProfile.linux": "zsh",
35+
36+
"editor.minimap.enabled": false,
37+
"editor.formatOnSave": true,
38+
"editor.formatOnPaste": true,
39+
"editor.rulers": [99],
40+
41+
"[python]": {
42+
"editor.defaultFormatter": "charliermarsh.ruff"
43+
},
44+
"[json]": {
45+
"editor.defaultFormatter": "esbenp.prettier-vscode"
46+
},
47+
"[jsonc]": {
48+
"editor.defaultFormatter": "esbenp.prettier-vscode"
49+
},
50+
"[makefile]": {
51+
"editor.tabSize": 8
52+
},
53+
"[yaml]": {
54+
"editor.tabSize": 2
55+
},
56+
57+
"python.defaultInterpreterPath": "/usr/local/bin/python",
58+
"python.testing.pytestEnabled": true,
59+
"python.testing.pytestArgs": ["-v", "-k", "mock"],
60+
61+
"files.watcherExclude": {
62+
"**/.git/objects/**": true,
63+
"**/node_modules/**": true,
64+
"**/.build/**": true,
65+
"**/__pycache__/**": true
66+
},
67+
"search.exclude": {
68+
"**/node_modules": true,
69+
"**/.build": true
70+
}
71+
},
72+
"extensions": [
73+
"charliermarsh.ruff",
74+
"ms-python.python",
75+
"ms-vscode.vscode-serial-monitor",
76+
"esbenp.prettier-vscode",
77+
"github.vscode-pull-request-github",
78+
"vivaxy.vscode-conventional-commits"
79+
]
2080
}
21-
}
22-
}
23-
}
81+
},
82+
83+
"postCreateCommand": "make setup && sudo /lib/systemd/systemd-udevd --daemon",
84+
"remoteUser": "vscode"
2485
}

0 commit comments

Comments
 (0)