Skip to content

Instantly share code, notes, and snippets.

@dabit3
Last active October 5, 2021 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dabit3/525cf3095624ec7462b290a7802c198b to your computer and use it in GitHub Desktop.
Save dabit3/525cf3095624ec7462b290a7802c198b to your computer and use it in GitHub Desktop.
OpenVSCode Server
# Build locally
# docker build . -t myvscodeapp
# Run locally
# docker run -it -p 3000:3000 myvscodeapp
FROM gitpod/openvscode-server:latest
USER root
ENV NODE_VERSION=14.18.0
RUN apt-get update
RUN apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash
ENV NVM_DIR=./.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="./.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
USER openvscode-server
@ghuntley
Copy link

ghuntley commented Oct 5, 2021

  1. Run install as openvscode-server user otherwise installation is likely to end up in /root/.nvm
  2. Append sudo to the curl -o- command
  3. Evaluate the nvm.sh in the bash profile of the openvscode-server as similar to thus …. RUN “echo ~/.nvm/nvm.sh use” >> /home/openscode-server/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment