vscode-dev-containers
vscode-dev-containers copied to clipboard
Headless browser (chrome/chromium/firefox) as a Feature
I'd love if I could add a headless browser to my dev container using the dev container features.
"features": {
"headless-chrome": "latest",
"headless-chromium": "latest",
"headless-firefox": "latest",
}
All (that I know) JS/TS testing frameworks need it. Manually adding it without having to resort to --no-sandbox is very complicated. I have yet to succeed at it 😞
--no-sandbox is considered insecure and strongly discouraged.
Relates to: Both
The "desktop-lite" script is set up to allow this kind of thing. Note that sandboxing requires running as a non-root user. It's not allowed as root since that's basically --no-sandbox. You also need to increase shared memory if you see crashes. This is described in https://github.com/devcontainers/features/tree/main/src/desktop-lite#resolving-crashes
However, if you'd like to create a feature for this, you can now contribute one that will show up in UX over the next month or so. https://github.com/devcontainers/feature-template covers how to author a feature, and to add it to an index, you can add your collection to this file: https://github.com/devcontainers/devcontainers.github.io/blob/gh-pages/_data/collection-index.yml
I made something and it appears to work. At least for me. It's early days and linux isn't my strong suite so I'm just throwing commands at the wall to see what sticks
Anyway https://github.com/snebjorn/devcontainer-feature/pkgs/container/devcontainer-feature%2Fchromium