Default Development Environment
About 263 wordsLess than 1 minute
Default Development Environment introduces the default Workspaces image and how to configure a command that runs automatically on startup.
When to use: when you have not specified an image but still want extra tooling or an init command. When docker.image / docker.build is not explicitly declared, the development environment uses the default image cnbcool/default-dev-env. Check what the default image ships with, then decide between a custom image and CNB_WELCOME_CMD.
Configure Automatic Command Execution
The default image comes with the VS Code extension cnb-welcome pre-installed, so no additional installation is needed. Configure the CNB_WELCOME_CMD environment variable to run a command once in the terminal when the development environment opens (WebIDE / remote client).
Configure in .cnb.yml
Declare a vscode event pipeline in the .cnb.yml of the repository's default branch and set CNB_WELCOME_CMD in env to automatically run the specified command in the terminal when the development environment opens:
$:
vscode:
- services:
- vscode
env:
CNB_WELCOME_CMD: echo "Environment ready, start coding"
stages:
- name: environment created
script: echo "development environment created"The value of CNB_WELCOME_CMD is a shell command, run once when you enter the development environment.
For multiple steps or special characters, write them into a script file first and set CNB_WELCOME_CMD to a command that invokes the script, such as bash /workspace/setup.sh.