Docker compose for VSCode server

  Apr 1, 2020      2m      0   
 

Set up Visual Studio Code server for development environment

Docker compose for VSCode server

Set up VSCode server

The original repository:

Github: https://github.com/cdr/code-server

docker-compose.yml

version: '3.3'
services:
    code-server:
        image: codercom/code-server
        ports:
            - '8181:8080'
        volumes:
            - '$HOME/.config:/home/coder/.config'
            - '$PWD:/home/coder/project'
        working_dir: /home/coder/project
        environment:
            PASSWORD: vscode
        user: root
        ipc: host
        restart: unless-stopped     # or "always"

Run docker container:

$ docker-compose up -d

Open your browser @ localhost:8181. Password to access: vscode (specified in the above script)

ps. Change the port 8181 to your favorite one.

Configure NGINX

Setup with HTTP (port 80):

server {
    listen 80;
    ### server_name YOUR_DOMAIN.COM;
    server_name _;
    
    sendfile on;

    charset utf-8;
    # max upload size
    client_max_body_size 50G; # adjust to taste

    location / {
        proxy_pass http://0.0.0.0:8181/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}

Setup with HTTPS (port 443):

server {
    listen 80;
    listen [::]:80;
    ### server_name YOUR_DOMAIN.COM;
    server_name _;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    ### server_name YOUR_DOMAIN.COM;
    server_name _;

    ### paths to certificate files
    ssl_certificate /root/ssl/official/gveyes/gveyes_net.cert;
    ssl_certificate_key /root/ssl/official/gveyes/gveyes_net.key;

    sendfile on;

    charset utf-8;
    # max upload size
    client_max_body_size 50G; # adjust to taste

    location / {
        proxy_pass http://0.0.0.0:8181/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}

More docker-compose files for you:



Khám phá xử lý ảnh - GVGroup




-->