Skip to content

Latest commit

 

History

History
196 lines (156 loc) · 5.98 KB

File metadata and controls

196 lines (156 loc) · 5.98 KB

IDE Code Server

English | 简体中文

A comprehensive development environment Docker image based on code-server, pre-configured with multiple programming language runtimes and China mainland mirror acceleration.

Features

  • Base: codercom/code-server:latest
  • User: coder with passwordless sudo (su blocked)
  • Languages: Go, Python 3.13, Node.js, JDK 21, Ruby/Rails
  • Tools: git, curl, wget, vim, tmux, dnsutils (nslookup), yq, kubectl, gopls, delve, uv, conda, pnpm, yarn, Maven, claude-code
  • Middleware Clients: MySQL CLI, PostgreSQL CLI (psql), Redis CLI, Docker CLI, Kafka CLI

Quick Start

docker run -d \
  --name ide-code-server \
  -p 8080:8080 \
  -v $(pwd)/project:/home/coder/project \
  -e PASSWORD=yourpassword \
  ghcr.io/your-username/ide-code-server:latest

Access at http://localhost:8080

Volume Mounts

Recommended External Mounts

For better persistence and performance, mount these directories externally:

Container Path Purpose Description
/home/coder/project Workspace Main workspace directory
/home/coder/.local/share/code-server VS Code Data Extensions, settings, and user data
/home/coder/.npm npm Cache npm global cache
/home/coder/.local/share/pnpm pnpm Store pnpm package store
/home/coder/go Go Packages GOPATH for user-installed Go packages
/home/coder/.cache/uv uv Cache uv Python package cache
/home/coder/.cache/pip pip Cache pip package cache
/home/coder/.m2/repository Maven Repo Maven local repository

Minimal Setup

docker run -d \
  --name ide-code-server \
  -p 8080:8080 \
  -v $(pwd)/project:/home/coder/project \
  -v $(pwd)/code-server:/home/coder/.local/share/code-server \
  -e PASSWORD=yourpassword \
  ghcr.io/your-username/ide-code-server:latest

Full Setup with All Mounts

docker run -d \
  --name ide-code-server \
  -p 8080:8080 \
  -v $(pwd)/project:/home/coder/project \
  -v $(pwd)/code-server:/home/coder/.local/share/code-server \
  -v $(pwd)/npm:/home/coder/.npm \
  -v $(pwd)/pnpm:/home/coder/.local/share/pnpm \
  -v $(pwd)/go:/home/coder/go \
  -v $(pwd)/cache/uv:/home/coder/.cache/uv \
  -v $(pwd)/cache/pip:/home/coder/.cache/pip \
  -v $(pwd)/m2:/home/coder/.m2/repository \
  -e PASSWORD=yourpassword \
  ghcr.io/your-username/ide-code-server:latest

Docker Compose

Minimal Configuration

services:
  ide-code-server:
    image: ghcr.io/your-username/ide-code-server:latest
    volumes:
      - ./project:/home/coder/project
      - ./code-server:/home/coder/.local/share/code-server
    ports:
      - "8080:8080"
    environment:
      - PASSWORD=yourpassword
    restart: unless-stopped

Full Configuration with All Mounts

services:
  ide-code-server:
    image: ghcr.io/your-username/ide-code-server:latest
    volumes:
      # Workspace
      - ./project:/home/coder/project
      # VS Code extensions and settings
      - ./code-server:/home/coder/.local/share/code-server
      # Node.js package caches
      - ./npm:/home/coder/.npm
      - ./pnpm:/home/coder/.local/share/pnpm
      # Go packages (GOPATH)
      - ./go:/home/coder/go
      # Python package caches
      - ./cache/uv:/home/coder/.cache/uv
      - ./cache/pip:/home/coder/.cache/pip
      # Maven local repository
      - ./m2:/home/coder/.m2/repository
    ports:
      - "8080:8080"
    environment:
      - PASSWORD=yourpassword
    restart: unless-stopped

Benefits of External Mounts

  1. VS Code Extensions (/home/coder/.local/share/code-server)

    • Extensions persist across container rebuilds
    • Share extensions between containers
    • Faster startup after rebuild
  2. Package Caches (/home/coder/.npm, /home/coder/.local/share/pnpm, etc.)

    • Avoid re-downloading packages
    • Share caches between containers
    • Faster dependency installation
  3. Language Packages (/home/coder/go, /home/coder/.m2/repository)

    • Persist globally installed packages
    • Go tools installed via go install
    • Maven dependencies cached locally

Mounting Entire /home/coder Directory

You can mount the entire /home/coder directory for maximum persistence:

docker run -d \
  --name ide-code-server \
  -p 8080:8080 \
  -v $(pwd)/coder-home:/home/coder \
  -e PASSWORD=yourpassword \
  ghcr.io/your-username/ide-code-server:latest

Auto-Initialization

When /home/coder is mounted (especially as an empty directory), the container automatically initializes:

File Purpose
.bashrc PATH restoration, rbenv initialization, and legacy rbenv path migration
.gemrc Ruby China mirror configuration
.m2/settings.xml Maven Aliyun mirror configuration
.config/pip/pip.conf pip Tsinghua mirror configuration

Required directories are also created automatically. Legacy shell entries that reference /home/coder/.rbenv are automatically migrated to /opt/rbenv during startup.

System Tools (Not Affected by Mounts)

The following components are installed in system directories and remain available regardless of volume mounts:

Component Location Tools
Go Tools /opt/go-tools/bin gopls, dlv, golangci-lint, goimports
Ruby (rbenv) /opt/rbenv ruby, gem, rails, bundler
Python/conda /opt/conda python, pip, conda
JDK /opt/temurin-21-jdk java, javac, jar
Maven /opt/apache-maven mvn
Kafka /opt/kafka kafka-topics, kafka-console-consumer, kafka-console-producer

Installed Languages

Language Version Tools Mirror
Go 1.26.1 gopls, delve, golangci-lint goproxy.cn
Python 3.13 uv, conda pypi.tuna.tsinghua.edu.cn
Node.js 22 LTS npm, pnpm, yarn npmmirror
JDK 21 Maven 3.9.11 Aliyun
Ruby 4.0.2 Rails, Bundler Ruby China

Build

docker build -t ide-code-server .

License

MIT