devcontainer: handle hosts without X11 (#29537)

* Setup xauthority link on host in initializeCommand

* Create a dummy xauthority if it does no exist on host machine

* Remove xauthority line from ci test
This commit is contained in:
Kacper Rączy
2023-08-23 10:26:38 -07:00
committed by GitHub
parent 363740a497
commit 659795b1db
4 changed files with 20 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
},
"postCreateCommand": "bash -c 'if [[ $DISPLAY == *xquartz* ]]; then echo \"export DISPLAY=host.docker.internal:0\" >> /root/.bashrc; fi'",
"postStartCommand": "git config --file .gitmodules --get-regexp path | awk '{ print $2 }' | xargs -I{} git config --global --add safe.directory \"$PWD/{}\"",
"initializeCommand": ".devcontainer/setup_host.sh",
"privileged": true,
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}",
@@ -13,7 +14,7 @@
},
"runArgs": [
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
"--volume=${localEnv:XAUTHORITY}:/root/.Xauthority",
"--volume=${localWorkspaceFolder}/.devcontainer/.Xauthority:/root/.Xauthority",
"--volume=${localEnv:HOME}/.comma:/root/.comma",
"--volume=/tmp/comma_download_cache:/tmp/comma_download_cache",
"--volume=/tmp/devcontainer_scons_cache:/tmp/scons_cache",