Implementation:Bentoml BentoML Common Debian Setup
| Knowledge Sources | |
|---|---|
| Domains | DevContainer, Shell Scripting, Environment Setup |
| Last Updated | 2026-02-13 15:00 GMT |
Overview
A Bash setup script that provisions a Debian-based VS Code devcontainer with common developer tools, user configuration, shell customization (Bash and Zsh with Oh My Zsh), and locale settings.
Description
This script is part of the Microsoft VS Code dev containers library and is used by the BentoML project to configure a reproducible development environment. It performs the following major operations:
- Package installation: Installs a comprehensive set of developer tools and system libraries including
curl,wget,git,jq,htop,vim-tiny,openssh-client,gnupg2, and many others viaapt-get. - User management: Creates or updates a non-root user with configurable UID/GID, adds sudo access, and handles automatic user detection from a list of common devcontainer usernames (
vscode,node,codespace). - Locale configuration: Ensures
en_US.UTF-8locale is available and generated. - Shell customization: Injects RC snippets into
.bashrcand.zshrcfor PATH management, first-run notices, and Git editor configuration. Installs custom Codespaces-themed prompts for both Bash and Zsh. - Oh My Zsh installation: Optionally clones and configures Oh My Zsh with a custom Codespaces theme.
- Shim scripts: Creates
/usr/local/bin/codeand/usr/local/bin/systemctlshim scripts for compatibility. - Marker file: Writes a state marker file at
/usr/local/etc/vscode-dev-containers/commonto enable idempotent re-runs.
The script is designed to be idempotent: it checks marker files to skip previously completed steps on subsequent runs.
Usage
This script is invoked during devcontainer image build (typically from a Dockerfile). It should be run as root. It is not called directly during normal BentoML development or runtime; it is part of the one-time container provisioning process.
Code Reference
Source Location
- Repository: Bentoml_BentoML
- File: .devcontainer/library-scripts/common-debian.sh
- Lines: 1-454
Signature
# Invocation syntax:
./common-debian.sh [install_zsh] [username] [user_uid] [user_gid] [upgrade_packages] [install_oh_my_zsh] [add_non_free_packages]
Import
# Sourced/executed from a Dockerfile:
COPY library-scripts/*.sh /tmp/library-scripts/
RUN bash /tmp/library-scripts/common-debian.sh "true" "vscode" "automatic" "automatic" "true" "true" "false"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| install_zsh | string ("true"/"false") | No (default: "true") | Whether to install Zsh shell |
| username | string | No (default: "automatic") | Username to create or configure; "automatic" detects existing user |
| user_uid | string | No (default: "automatic") | Desired UID for the user; "automatic" uses system defaults |
| user_gid | string | No (default: "automatic") | Desired GID for the user; "automatic" uses system defaults |
| upgrade_packages | string ("true"/"false") | No (default: "true") | Whether to upgrade all installed packages |
| install_oh_my_zsh | string ("true"/"false") | No (default: "true") | Whether to install Oh My Zsh |
| add_non_free_packages | string ("true"/"false") | No (default: "false") | Whether to enable Debian non-free repos for POSIX manpages |
Outputs
| Name | Type | Description |
|---|---|---|
| Marker file | File | /usr/local/etc/vscode-dev-containers/common tracking installation state
|
| Configured user | System user | Non-root user with sudo, shell configuration, and RC files |
| Installed packages | APT packages | Developer tools and system libraries installed via apt-get |
| Shell configuration | Files | Customized .bashrc, .zshrc, and Oh My Zsh theme files
|
Usage Examples
# Default invocation - install everything with automatic user detection
sudo bash /tmp/library-scripts/common-debian.sh
# Custom invocation - specific user, no zsh, no package upgrade
sudo bash /tmp/library-scripts/common-debian.sh "false" "devuser" "1000" "1000" "false" "false" "false"
# Typical Dockerfile usage
RUN bash /tmp/library-scripts/common-debian.sh "true" "vscode" "automatic" "automatic" "true" "true" "false"