This repository provides docker containers configured to run VSCode and Opencode.
There are custom configurations for specific development environments, such as TypeScript and Python. Each variant has predefined extensions, settings, and tools tailored to the respective programming environment.
- Includes:
ms-python.pythonextension for Python development (test running/play button enabled).- Python development tools, such as
flake8,autopep8, andmypy. eamodio.gitlensfor Git blame and enhanced Git capabilities.- Configured keyboard shortcuts:
- Command/Control + U: Expand selection.
- Shift + Command/Control + U: Contract selection.
- Includes:
- TypeScript-related extensions:
dbaeumer.vscode-eslint,esbenp.prettier-vscode, andms-vscode.vscode-typescript-tslint-plugin. ms-vscode.vscode-jest, configured to work with Vitest (requires setup, see below).eamodio.gitlensfor Git blame and enhanced Git capabilities.- Configured keyboard shortcuts:
- Command/Control + U: Expand selection.
- Shift + Command/Control + U: Contract selection.
- TypeScript-related extensions:
To build the Docker images for each variant, use the build.sh script.
- Build a specific variant. For example:
./build.sh python ./build.sh ts
This will create Docker images tagged as jdcode-python and jdcode-ts.
We've created a simplified CLI tool to make running containers much easier:
-
Install jdcode CLI (run once):
./install-jdcode.sh
-
Run containers with minimal commands:
jdcode python # Run Python variant jdcode ts # Run TypeScript variant
If you prefer to run docker commands directly:
Note: Binding ports in docker uses the -p flag in the form HOST_PORT:CONTAINER_PORT
-
Run the containers: Start each environment by binding the appropriate port:
- For Python:
docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 jdcode-python - For TypeScript:
docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 jdcode-ts
The
-v /etc/localtime:/etc/localtime:romount syncs the container clock with your host timezone. Without it, the container defaults to UTC. - For Python:
-
Access the VSCode instance:
- Open your browser to
http://localhost:8080
- Open your browser to
-
Access OpenCode
- In your container, execute
opencode
- In your container, execute
Both variants include a Telegram notification plugin that sends messages via a Telegram bot when OpenCode session events occur (idle, errors, completion).
Prerequisites:
- A Telegram bot created via @BotFather
- Your bot token and chat ID (see
TELEGRAM_SETUP.mdfor details)
Run with Telegram notifications enabled:
-
For Python:
docker run -it --rm \ -v "$PWD":/code \ -v /etc/localtime:/etc/localtime:ro \ -p 8080:8080 \ -e TELEGRAM_ENABLED=true \ -e TELEGRAM_BOT_TOKEN=your_bot_token \ -e TELEGRAM_CHAT_ID=your_chat_id \ jdcode-python -
For TypeScript:
docker run -it --rm \ -v "$PWD":/code \ -v /etc/localtime:/etc/localtime:ro \ -p 8080:8080 \ -e TELEGRAM_ENABLED=true \ -e TELEGRAM_BOT_TOKEN=your_bot_token \ -e TELEGRAM_CHAT_ID=your_chat_id \ jdcode-ts
Using environment file:
Create a .env file with your credentials:
TELEGRAM_ENABLED=true
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_hereThen run with:
docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 --env-file .env jdcode-tsNotification Events:
- 🤖 Session idle notifications
- ❌ Session error alerts
- 🗑️ Session completion messages
See .env.example for a template configuration file.
To avoid typing long docker commands, you can create shell aliases:
Add these lines to your ~/.bashrc or ~/.zshrc:
# Basic aliases
alias jdcode-python='docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 jdcode-python'
alias jdcode-ts='docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 jdcode-ts'
# With Telegram notifications (requires environment variables to be set)
alias jdcode-python-notify='docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 -e TELEGRAM_ENABLED=true -e TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN" -e TELEGRAM_CHAT_ID="$TELEGRAM_CHAT_ID" jdcode-python'
alias jdcode-ts-notify='docker run -it --rm -v "$PWD":/code -v /etc/localtime:/etc/localtime:ro -p 8080:8080 -e TELEGRAM_ENABLED=true -e TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN" -e TELEGRAM_CHAT_ID="$TELEGRAM_CHAT_ID" jdcode-ts'Then reload your shell configuration:
source ~/.bashrc # or source ~/.zshrcAfter setting up the aliases, you can simply run:
# Basic usage
jdcode-python # Start Python development environment
jdcode-ts # Start TypeScript development environment
# With Telegram notifications (requires Telegram env vars)
jdcode-python-notify # Python with Telegram notifications
jdcode-ts-notify # TypeScript with Telegram notificationsIf you've installed the jdcode CLI tool, you can also run:
# Basic usage
jdcode python # Run Python variant
jdcode ts # Run TypeScript variant
# With custom port
jdcode python --port 9000
# With Telegram notifications
jdcode python --telegram
# Using environment file
jdcode ts --env-file .envThe ms-vscode.vscode-jest extension can be made to work with Vitest:
-
Update your
package.jsonto alias Jest commands to Vitest:{ "scripts": { "test": "vitest", "test:watch": "vitest --watch", "test:coverage": "vitest --coverage", "jest": "vitest", "jest:watch": "vitest --watch" } } -
Configure VSCode to use the
npm test --command for the play button (already in thesettings.json):{ "jest.jestCommandLine": "npm test --" }
For more details, refer to the official Vitest Documentation.
Released into the public domain under the Unlicense.