Skip to content

Commit f33bbf2

Browse files
authored
Add dind feature to devcontainer to seperate envs (hacs#4)
1 parent b1956f2 commit f33bbf2

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed

.devcontainer.json

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
{
22
"name": "hacs/addons",
33
"image": "ghcr.io/home-assistant/devcontainer:addons",
4-
"appPort": [
5-
"7123:8123",
6-
"7357:4357"
7-
],
8-
"postStartCommand": "bash devcontainer_bootstrap",
9-
"runArgs": [
10-
"-e",
11-
"GIT_EDITOR=code --wait",
12-
"--privileged"
4+
"forwardPorts": [
5+
8123,
6+
4357
137
],
8+
"portsAttributes": {
9+
"4357": {
10+
"label": "Home Assistant Observer"
11+
},
12+
"8123": {
13+
"label": "Home Assistant UI"
14+
}
15+
},
16+
"postStartCommand": "bash script/setup",
1417
"remoteUser": "root",
1518
"containerEnv": {
1619
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
1720
},
21+
"mounts": [
22+
{
23+
"source": "hacs-addon-dind-var-lib-docker",
24+
"target": "/var/lib/docker",
25+
"type": "volume"
26+
},
27+
{
28+
"source": "hacs-addon-supervisor-data",
29+
"target": "/supervisor_data",
30+
"type": "volume"
31+
}
32+
],
1833
"customizations": {
1934
"vscode": {
2035
"extensions": [
2136
"timonwong.shellcheck",
2237
"esbenp.prettier-vscode"
2338
],
24-
"mounts": [
25-
"type=volume,target=/var/lib/docker"
26-
],
2739
"settings": {
2840
"terminal.integrated.profiles.linux": {
2941
"zsh": {
@@ -37,5 +49,8 @@
3749
"files.trimTrailingWhitespace": true
3850
}
3951
}
52+
},
53+
"features": {
54+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
4055
}
4156
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"label": "Start Home Assistant",
66
"type": "shell",
7-
"command": "supervisor_run",
7+
"command": "bash script/develop",
88
"group": {
99
"kind": "test",
1010
"isDefault": true

script/develop

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
bash supervisor_run

script/setup

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p /tmp
4+
ln -sf /supervisor_data /tmp/supervisor_data
5+
6+
bash devcontainer_bootstrap

0 commit comments

Comments
 (0)