Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install extensions while building docker image #484

Closed
yamajik opened this issue Apr 11, 2019 · 11 comments
Closed

How to install extensions while building docker image #484

yamajik opened this issue Apr 11, 2019 · 11 comments
Labels
enhancement Some improvement that isn't a feature

Comments

@yamajik
Copy link
Contributor

yamajik commented Apr 11, 2019

Could I install extensions over cli? Or during docker image building?

@yamajik yamajik added the enhancement Some improvement that isn't a feature label Apr 11, 2019
@adrianliechti
Copy link

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

@yamajik
Copy link
Contributor Author

yamajik commented Apr 12, 2019

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?

@foresthoffman
Copy link
Contributor

@yamajik The official VSCode extensions are not distributed in Tar format, they are Zips.

@adrianliechti
Copy link

@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

@yamajik
Copy link
Contributor Author

yamajik commented Apr 13, 2019

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 🤦‍♀️

@adrianliechti
Copy link

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}

@foresthoffman
Copy link
Contributor

@adrianliechti That's because the Microsoft VSCode Extension Marketplace API is not public. Using it in this way is against their TOS.

@yamajik
Copy link
Contributor Author

yamajik commented Apr 16, 2019

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.
Screen Shot 2019-04-16 at 15 03 06

@lucacasonato
Copy link
Contributor

Can now be done reasonably cleanly with changes from #504. There are no docs on this yet afaik.

@adrianliechti
Copy link

@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...

@foresthoffman
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Some improvement that isn't a feature
Projects
None yet
Development

No branches or pull requests

4 participants