I use a custom built Docker image across multiple projects that contains a custom shell, OS packages and programming language related packages.
However, every time I use the container for a new project, it reinstall VS code server and all the VS code extensions described devcontainer.json which can be slow.
It would be a nice addition to allow VS code server to be pre-installed with some extensions in a Docker image, so that the boot up time for a new project would be minimal.
Thank you 馃憤 !
It mentions how to workaround this here so I will close it for now.
Actually this workaround does not really answer ny question, how can I manually install VS code with some default extensions in the Docker image using the Dockerfile?
I also need this feature to build a instant development environment. Currently I have to manually install extensions through vscode remote ssh
Agreed. A way to pre-install the dependencies into a container, e.g.
apt-get install vs-code-server
Would be very useful
For the VScode server binary, as it's closed source, is there an url to the binary? For which cpu architectures? Is it compiled statically (i. e. does it work with musl instead of glibc)?
For extensions, if, at docker image build time, we put the vscode (non server) binary, install extensions with it, and then remove the binary, would these extensions be valid when used server side with the vscode server program?
Thanks!
For the VScode server binary, as it's closed source, is there an url to the binary? For which cpu architectures? Is it compiled statically (i. e. does it work with musl instead of glibc)?
For extensions, if, at docker image build time, we put the vscode (non server) binary, install extensions with it, and then remove the binary, would these extensions be valid when used server side with the vscode server program?
Thanks!
code-server can install extensions via command line:
code-server --extensions-dir ~/.vscode/extensions \
--install-extension <extension-id or vsix file>
Nice thanks, that should solve it. I'll report back and close the issue if it fully does :+1:
I also would appreciate a feature like apt-get install vs-code-server in order to be able to preinstall the vscode server with a Dockerfile.
Personally I think the main reasons for this approach would be:
There are multiple relatively easy ways to install code-server. I had a bit of trouble setting it up on alpine. In the end I use for example to pre-install shardulm94.trailing-spaces:
USER root
RUN apk add -q --update --progress --no-cache --virtual codeserverdeps npm build-base libx11-dev libxkbfile-dev libsecret-dev python2 && \
npm install -g --unsafe-perm @google-cloud/logging@^4.5.2 code-server && \
code-server --extensions-dir /home/myuser/.vscode-server/extensions --install-extension shardulm94.trailing-spaces && \
chown -R myuser /home/myuser/.vscode-server
apk del codeserverdeps && \
rm -rf /usr/bin/code-server /usr/lib/node_modules /root/.npm /usr/local/share/.cache/yarn
USER myuser
So that it doesn't increase the image size with dependencies for code-server (node, c libs, etc.). This seems to fix the extensions pre-installing part, and doesn't increase the image size really (although it takes a while for the docker image to build). If there is a faster way to install extensions that would be great (maybe using node and npm/yarn only).
Now remains the vscode-server pre-install at docker build stage. I don't think code-server can replace the vscode server setup in ~/.vscode-server. Is there any solution to that perhaps? Or maybe a reason this shouldn't be pre-installed in the image (i.e. vscode versioning)?
Thanks!
EDIT: Actually for extensions made to work for remote development container, this approach does not work as it installs the 'client side' of the extension on the remote container, so there is something missing on the container side or on the host (client) side.
Any news on this?
My use case is that I need to attach to containers running on Kubernetes (Dev environment).
Right now every time I attach to a new container I need to wait that vscode-server is installed and then I manually have to install the debugger extension.
Installing vscode-server directly in the image would be so much simpler.
+1
There are so many ways to create a multi-container backend stack for the IDE:
Most helpful comment
Actually this workaround does not really answer ny question, how can I manually install VS code with some default extensions in the Docker image using the Dockerfile?