Sign inSign up

google85/vscode-devcontainer-node

By google85

Updated over 2 years ago

DockerHub VsCode devcontainer NodeJS configurable image, with Intellisense & hot-reloading.

Image
1

571

google85/vscode-devcontainer-node repository overview

DockerHub VsCode devcontainer NodeJS configurable image.

Tools provided:
  • nodemon - for hot-reloading your app
Getting started:
  • Clone the demo-project branch in an empty directory: [PENDING]

    git clone --branch=demo-project  https://github.com/google85/vscode-devcontainer-node.git  node-project
    cd node-project/
    
  • Open project in VsCode

    code .
    
  • Use VsCode Reopen in DevContainer option.

  • Open a terminal in VsCode and type:

    cd src/
    make
    

Advanced usage:
  • Pull the image

    docker pull google85/vscode-devcontainer-node:20.11.1
    
  • Create a .devcontainer folder in the root of your project

    mkdir -p .devcontainer
    
  • Create the devcontainer.json configuration file

    cat <<EOF | tee .devcontainer/devcontainer.json
    {
        "name": "node-project",
        "dockerComposeFile": "docker-compose.devcontainer.yml",
        "service": "node-devcontainer",
        "workspaceFolder": "/home/node/app",
        "mounts": [
            "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/node/.ssh,type=bind,consistency=cached",
    	    "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/root/.ssh,type=bind,consistency=cached",
    	    "source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached",
    	    "source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached"
        ],
        "customizations": {
            "vscode": {
                "settings": {
                },
    
                // Add the IDs of extensions you want installed when the container is created.
                "extensions": [
                ]
            }
        },
        "postCreateCommand": "after-setup.sh",
        "forwardPorts": [
            // 8000
        ]
    }
    EOF
    
  • Create the docker-compose.devcontainer.yml to be used

    cat <<EOF | tee .devcontainer/docker-compose.devcontainer.yml
    version: '3'
    services:
    node-devcontainer:
        image: google85/vscode-devcontainer-node:20.11.1
        hostname: node-devcontainer
        working_dir: /home/node/app
        #env_file:
        #- ../.env
        environment:
            - TZ=Europe/Bucharest
        volumes:
            - ..:/home/node/app
        extra_hosts:
        - "host.docker.internal:host-gateway"
        tty: true # very important
    EOF
    
  • Open project in VsCode

  • Use VsCode Reopen in DevContainer option.

Tag summary

Content type

Image

Digest

sha256:66b55566b

Size

359 MB

Last updated

over 2 years ago

docker pull google85/vscode-devcontainer-node