GithubHelp home page GithubHelp logo

Comments (3)

khiron avatar khiron commented on August 17, 2024

RE: preconfiguring the container for VS Code extensions and settings

When you are asked by VS Code if you want to install an extension in a container, it doesn't change the container, it just adding a file to the host OS for that container.

So in /Users/richard/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/imageConfigs there is a file called my workshop.json which contains everything "installed" to the container

{
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"ms-toolsai.vscode-jupyter-cell-tags",
"ms-toolsai.vscode-jupyter-slideshow"
],
"workspaceFolder": "/",
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh"
}
}

So there is nothing I can put in the container that will install VS Code extensions.

There may be something I can do with DevContainers which is a Microsoft super specification for DockerFiles. Looking into it.

from cogent3workshop.

khiron avatar khiron commented on August 17, 2024

ZSH is installed in the container and set as the default shell as follows;

# Install Oh My Zsh
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Set zsh as the default shell
SHELL ["/usr/bin/zsh", "-c"]

# Create a default .zshrc file with some suggested configurations
RUN echo 'export ZSH="$HOME/.oh-my-zsh"' >> $HOME/.zshrc && \
    echo 'ZSH_THEME="robbyrussell"' >> $HOME/.zshrc && \
    echo 'plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump)' >> $HOME/.zshrc && \
    echo 'source $ZSH/oh-my-zsh.sh' >> $HOME/.zshrc && \
    echo 'export HISTFILE=~/.zsh_history' >> $HOME/.zshrc && \
    echo 'export HISTSIZE=10000' >> $HOME/.zshrc && \
    echo 'export SAVEHIST=10000' >> $HOME/.zshrc && \
    echo 'setopt appendhistory' >> $HOME/.zshrc && \
    echo 'setopt histignorespace' >> $HOME/.zshrc && \
    echo 'setopt histignorealldups' >> $HOME/.zshrc && \
    echo 'source /c3workshop/bin/activate' >> $HOME/.zshrc

# Install zsh-autosuggestions and zsh-syntax-highlighting plugins
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

So running the container with the run command "/usr/bin/zsh" instead of "bin/bash" should work

I've changed the terminal mode wiki page to reflect that

https://github.com/cogent3/Cogent3Workshop/wiki/terminal-mode

VS needs to be prepopulated with "terminal.integrated.defaultProfile.linux": "zsh" to be the default shell in it's terminal. Working on that

from cogent3workshop.

khiron avatar khiron commented on August 17, 2024

I was mistaken about the vscode-server/extensions. prepopulating with a 45MB extra payload and hard coding the extensions that exist today is a hack but it works.

I have a simpler solution (in branch https://github.com/cogent3/Cogent3Workshop/blob/code-server/ ) by installing code-server (the open source VS code on a browser project) into the container which can populate the extensions by name - downloading the latest automatically upon first time use of the container.

Working on a branch using devcontainer (https://github.com/cogent3/Cogent3Workshop/tree/devcontainer) that appears to be the preferred Microsoft solution for using containers in vs code. All extensions and vs code setting are predefined in the devcontainer file independently of the DockerFile and VS code manages teh building and running of the container ... so it will need almost no command line work. Just point and click in VS code to build a container, run it and work with it

from cogent3workshop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.