How to install extensions while building docker image
Could I install extensions over cli? Or during docker image building?
ciao @yamajik
have a look at our Dockerfile at https://github.com/monostream/code-server/blob/develop/Dockerfile at the end of the file. We download the VSIX from the marketplace and extract it to the extensions folder. make sure you use bsdtar for this
cheers
ciao @yamajik
have a look at our Dockerfile at https://github.com/monostream/code-server/blob/develop/Dockerfile at the end of the file. We download the VSIX from the marketplace and extract it to the extensions folder. make sure you use bsdtar for this
cheers
ENV HOME_DIR "/root"
# Setup User Visual Studio Code Extentions
ENV CODE_SERVER_EXTENSIONS "${HOME_DIR}/.local/share/code-server/extensions"
# Setup User Visual Studio Code Workspace Storage
ENV CODE_SERVER_WORKSPACESTORAGE "${HOME_DIR}/.code-server/User/workspaceStorage"
# Mkdir Workspace Storage
RUN mkdir -p ${CODE_SERVER_WORKSPACESTORAGE}
# Setup Python Extension
RUN mkdir -p ${CODE_SERVER_EXTENSIONS}/python \
&& curl -JLs --retry 5 https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/latest/vspackage | bsdtar --strip-components=1 -xf - -C ${CODE_SERVER_EXTENSIONS}/python extension
bsdtar: Error opening archive: Unrecognized archive format
whats wrong?
@yamajik The official VSCode extensions are not distributed in Tar format, they are Zips.
@yamajik i recognized this as well from time to time while building the image... it seems the marketplace fails deliver the vsix file somwtime
a repeating docker build usually works... and since docker is caching the layers, it takes not as long as the first time
i have
@yamajik i recognized this as well from time to time while building the image... it seems the marketplace fails deliver the vsix file somwtime
a repeating docker build usually works... and since docker is caching the layers, it takes not as long as the first time
find it too and terriable it is. i have to build 60 different images every update time and retry for max 3 times on each building. still failed sometimes 🤦♀️
this is the error of a failed download:
{"$id":"1","innerException":null,"message":"Anonymous usage from IP address xxx.xxx.xxx.xxx has exceeded our rate limits and is being blocked. Anonymous access from this IP address will be unblocked within the next 1 minute. You can also consider logging in to get unblocked. Logged in users have higher limits. Learn more: https://go.microsoft.com/fwlink/?LinkId=823950.","typeName":"Microsoft.TeamFoundation.Framework.Server.RequestBlockedException, Microsoft.TeamFoundation.Framework.Server","typeKey":"RequestBlockedException","errorCode":0,"eventId":3000}
@adrianliechti That's because the Microsoft VSCode Extension Marketplace API is not public. Using it in this way is against their TOS.
this is the error of a failed download:
{"$id":"1","innerException":null,"message":"Anonymous usage from IP address xxx.xxx.xxx.xxx has exceeded our rate limits and is being blocked. Anonymous access from this IP address will be unblocked within the next 1 minute. You can also consider logging in to get unblocked. Logged in users have higher limits. Learn more: https://go.microsoft.com/fwlink/?LinkId=823950.","typeName":"Microsoft.TeamFoundation.Framework.Server.RequestBlockedException, Microsoft.TeamFoundation.Framework.Server","typeKey":"RequestBlockedException","errorCode":0,"eventId":3000}
It also makes extensionquery error. Couldn't install other exts.

Can now be done reasonably cleanly with changes from #504. There are no docs on this yet afaik.
@foresthoffman are you sure? I ask because if you navigate to https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp for example, you find on the right side a "Download Extension" link in the section of "Resources"... looks pretty public to me...
@yamajik This is expected. Please see my comment to @adrianliechti below.
@lucacasonato Yes, thank you. That addition to the CLI will make this much more achievable.
@adrianliechti I am absolutely certain. Using an HTTP(S) client to access the Microsoft servers and download an extension is completely different from using an API with documented endpoints, required request values, and expected response values.
@adrianliechti That's because the Microsoft VSCode Extension Marketplace API is not public. Using it in this way is against their TOS.
Since the original question was regarding installing extensions via the CLI, and #504 has fixed this, i'll be closing this issue. Thank you.