Install VS Code 1.45.1 with Marketplace Extension support

christopher.wellington
christopher.wellington Member, Administrator, Domino Posts: 20 admin
edited August 2020 in Tutorials & Best Practices

To install the latest code-server (3.4.1) release of VS Code (1.45.1) in a Domino compute environment, we recommend following the procedure below. We've included the ms-python extension with the install and at the end of this post we'll show you how to install additional extensions in your compute environment.

Create a new Compute Environment

  • Create a new compute environment and name it something descriptive such as "Ubuntu18_DAD_Py3.6_R3.6_VSCode1.45"
  • Set the base image to: dominodatalab/base:Ubuntu18_DAD_Py3.6_R3.6_20200508

Dockerfile instructions:

# # # #Remove old versions of VS Code, Nodejs, and the python extension
RUN rm -rf /var/opt/workspaces/vscode && rm -rf /opt/code-server && apt-get remove nodejs -y && rm -rf /home/ubuntu/.local/share/code-server/extensions/*

# # # #Copy in VS Code 1.45 start and install scripts from commit 308ea504aa6f34056f27942188189a571a29bcef
RUN mkdir -p /var/opt/workspaces/vscode && \
    cd /tmp && wget -O vscode145.zip https://github.com/dominodatalab/workspace-configs/archive/308ea504aa6f34056f27942188189a571a29bcef.zip && \
    unzip vscode145.zip && mv workspace-configs-308ea504aa6f34056f27942188189a571a29bcef vscode145 && cp -Rf vscode145/vscode/. /var/opt/workspaces/vscode && \
    rm -rf /var/opt/workspaces/workspace-logos && rm -rf /tmp/vscode145 && rm -rf /tmp/vscode145.zip

# # # #Install VS Code from workspaces
RUN chmod +x /var/opt/workspaces/vscode/install && \
    /var/opt/workspaces/vscode/install && \
    chown -R ubuntu:ubuntu /home/ubuntu/.config/

Pluggable Workspace Tools

  • The Properties for Workspaces section needs to include this. Feel free to add entries for the other notebooks here as well.
vscode:
  title: "vscode"
  iconUrl: "/assets/images/workspace-logos/vscode.svg"
  start: [ "/var/opt/workspaces/vscode/start" ]
  httpProxy:
    port: 8888
    requireSubdomain: false

Build the environment.


Python Interpreter

Once you start up a VS Code workspace and open up a python file, $(which python) will automatically be set as the default version for the python interpreter. When you first open a python file you should see VS Code loading the extension in the bar at the bottom. You can also change the python interpreter within the session via the Command Palette.

VS Code Marketplace Extensions

You can install additional extensions for VS Code using the marketplace. See available extensions at https://marketplace.visualstudio.com/vscode. Search for the extension in VS Code, click install, and the latest compatible version will be installed. You may have to reload the session before using the new extension.


Install extensions so they load with VS Code workspaces automatically

If you would like an extension to be preloaded each time VS Code is started, you can add the install commands to the dockerfile instructions. 

Here's an example for preloading the julialang extension.

  • First start up a VS Code workspace and find the extension in the marketplace. You'll need the Extension identifier later on.
    • eg.
  • Paste the following code into your dockerfile instructions, somewhere after the new VS Code install commands.
# # # #Install Julialang VSCode extension
RUN \
    cd /tmp && \
    export PATH=/opt/code-server:$PATH && \
    code-server \
        --install-extension julialang.language-julia-insider \
        --extensions-dir /home/ubuntu/.local/share/code-server/extensions && \
    chown -R ubuntu:ubuntu /home/ubuntu/.local/ && \
    rm -rf /tmp/*
  • After where it says --install-extension in the code, paste in the Extension identifier as shown in the example above.

Build the environment.

Let us know if you run into any issues!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!