Skip to content

Commit

Permalink
build(devcontainer): 🐛 working D-Bus session/system bus in devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Feb 26, 2024
1 parent 42375bc commit 8a4acd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 3 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@
"shutdownAction": "stopCompose",
"containerUser": "vscode",
"containerEnv": {
"TZ": "${localEnv:TZ:Australia/Brisbane}",
"TZ": "${localEnv:TZ:Australia/Brisbane}"
},
"remoteEnv": {
"DBUS_SESSION_BUS_ADDRESS": "${localEnv:DBUS_SESSION_BUS_ADDRESS}"
},
"features": {
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/python:1": {}
},
"postCreateCommand": ".devcontainer/postCreate.sh",
"postStartCommand": {
"dbus-system": "sudo service dbus start"
// "dbus-session": "export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address)"
},
"remoteEnv": {
"DBUS_SESSION_BUS_ADDRESS": "${containerEnv:DBUS_SESSION_BUS_ADDRESS}"
},
"customizations": {
"vscode": {
"extensions": [
Expand Down
10 changes: 8 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ services:
volumes:
- ../..:/workspaces:cached
- /etc/localtime:/etc/localtime:ro,cached
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
- /run/user/1000/bus:/run/user/1000/bus
network_mode: host
userns_mode: keep-id
user: vscode
command: dbus-run-session -- sleep infinity
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
command: sleep infinity
home-assistant:
image: ghcr.io/home-assistant/home-assistant:2024.2.0
image: ghcr.io/home-assistant/home-assistant:2024.2.3
volumes:
- ../deployments/home-assistant/config:/config
environment:
Expand Down

0 comments on commit 8a4acd5

Please sign in to comment.