Code Server

无论何时何地,你只需要拥有一台带浏览器的电脑。无需安装任何环境和软件,你就可以开始利用云端VsCode开始软件开发,利用Dokploy一键部署云端VsCode。注意,下方是docker-componse,需要将下方的password字段改为自己的密码,用于编辑器登录。

version: '3'

services:
  code-server:
    container_name: code-server
    environment:
      - PUID=0
      - PGID=0
      - TZ=Asia/Shanghai
      - PASSWORD=<your password>
      - DEFAULT_WORKSPACE=/config/workspace
    image: lscr.io/linuxserver/code-server:latest
    ports:
      - "8443:8443"
      - "9001:9001"
      - "9002:9002"
      - "9003:9003"
      - "9004:9004"
      - "9005:9005"
    restart: unless-stopped
    networks:
      - dokploy-network
  mysql-demo:
    container_name: mysql-demo
    image: mysql:5.7.34
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - MYSQL_DATABASE=demo
    volumes:
      - mysql-demo-data:/var/lib/mysql
    restart: unless-stopped
    networks:
      - dokploy-network
  redis-demo:
    container_name: redis-demo
    image: redis:latest
    volumes:
      - redis-demo-data:/data
    restart: unless-stopped
    networks:
      - dokploy-network

volumes:
  mysql-demo-data:
  redis-demo-data:

sudo apt update
sudo apt install nodejs npm -y

# 检查版本
nodejs --version

# 更新到最新版本
sudo npm i -g n
sudo n latest
sudo npm i -g npm

# 安装pnpm
sudo npm i -g pnpm

注意

ports可以只暴露出8443核心,其他内部应用端口,VsCode可以自动代理,代理结果为https://<host>/proxy/<port>/