spec icon indicating copy to clipboard operation
spec copied to clipboard

Support post VScode install hook

Open 2tony2 opened this issue 2 years ago • 1 comments

Context

Hey all. I was working with devcontainers in the following setting:

Let's say I'm trying to get SSO to work with an external browser in a dev container. This is tricky because most SSO applications (and a lot of other ones for that matter) tend to use "Any free TCP port available". On linux, the OS will resolve this to a random available port. I found a work around to make this work by restricting available port range with something like sysctl net.ipv4.ip_local_port_range: "60000 60100" and just port forward those.

Now, I've noticed setting this on the docker build really hampers VScode devcontainers. Specifcally, the installation of extensions becomes very slow. There seems to be a lot of dynamic port use in the background when VScode is initially setting up a server and extensions on the dev container.

It's possible to resolve this (and other use cases I presume) by having some sort of a post-VScode build hook. Right now, all of the hooks given in the devcontainer.json cannot wait for the full VScode initialization to be complete before running code. The workaround now is doing something like adding entries to .bashrc or .zshrc to introduce custom pre-shell hooks whenever opening a new shell post build.

I'd think it makes sense to have support for a post VScode initialization hook within devcontainer.json, but not sure about the feasbility of something like that.

2tony2 avatar Feb 07 '24 10:02 2tony2

Hello 👋

Looping in @chrmarti who has expertise on how VS Code initialization works and even if this request is doable/feasible.

to have support for a post VScode initialization hook within devcontainer.json

This sounds like an enhancement to the spec and a request for a new lifecycle hook. Hence, moving this to the spec repo.

samruddhikhandale avatar Feb 07 '24 23:02 samruddhikhandale