See documentation for more details
This example demonstrates:
Dockerfile to customize development environmentvscode configuration: modify .ide/settings.json and copy it to containercode-server and common extensionsremote-ssh support: install openssh-serverThe first time building the development environment requires docker build to create the image, which will be pushed to the artifact repository.
Subsequent remote development sessions will directly use the pre-built image.
This means the first startup will be slower, but subsequent startups will be much faster.
After modifying the Dockerfile:
If building .ide/Dockerfile requires other files, they must be declared in the pipeline (using docker.build.by field), otherwise errors will occur.
Example:
# .cnb.yml
$:
# vscode event: specifically for launching remote development from the page
vscode:
- docker:
# Custom development environment
build:
# Specify Dockerfile for building image
dockerfile: .ide/Dockerfile
# Declare files needed for build process
# Note: If other files are used during build, they must be declared here
# Reference: https://docs.cnb.cool/zh/grammar/pipeline.html#build
by:
- .ide/settings.json
services:
# Enable vscode service
- vscode
# Enable docker commands in container
- docker
stages:
# Commands to execute after environment starts
- name: ls
script: ls -al