-
Notifications
You must be signed in to change notification settings - Fork 0
base system
This module describes the core OS setup (atom) and the basic runtime and environment manager setup (base).
The atom image is the foundational layer for all images. It performs minimal OS configuration and sets up general shell utilities.
-
Base Image:
ubuntu:noble(Ubuntu 24.04 LTS). -
Environment:
-
DEBIAN_FRONTEND=noninteractiveto suppress interactive prompts during package installs. - Sane default locale exports (
LC_CTYPE=C.UTF-8,LANG=en_US.UTF-8, etc.).
-
-
Shell Wrapper:
By default, commands are run in
/bin/bash --login -c. -
System Profile Hook:
Ensures that system profiles in
/etc/profileare sourced appropriately and sets check flags (ENTER_PROFILE) to avoid duplicate profiles load cycles.
To improve build performance in regions with restricted access to global mirrors (e.g. China), the build system provides localization routing scripts under /opt/utils/localize/.
- Evaluates
$1(first argument) or looks for the$PROFILE_LOCALIZEenvironment variable. Defaults to"default". - Dynamically sources the matching mirror configuration script:
/opt/utils/localize/run-config-mirror-${PROFILE_LOCALIZE}.sh.
-
default: Sane defaults; updates local timezone (Asia/Shanghai) and displays standard package manager registries (Apt, Pip, Npm, Go, R). -
tsinghua: Sets up mirrors hosted by Tsinghua University (TUNA):-
Apt: Replaces archive/security mirror endpoints with
mirrors.tuna.tsinghua.edu.cn. -
Pip: Configures
/etc/pip.confto targethttps://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/. -
Node/NPM: Sets registry mirror to
https://registry.npmmirror.comfor npm, pnpm, yarn, and bun. -
Go: Exports
GOPROXY=https://goproxy.cn. -
R: Configures CRAN repository target in
/etc/R/Rprofile.site.
-
Apt: Replaces archive/security mirror endpoints with
-
aliyun-pub/aliyun-vpc: Configures Alibaba Cloud public/private mirrors for Apt, Pip, Npm, and Go. -
tencent-pub/tencent-vpc: Configures Tencent Cloud public/private mirrors for Apt, Pip, Npm, and Go.
Located at /opt/utils/script-utils.sh inside the container, this library contains functions used for dependency resolution and system cleaning.
Key functions:
-
install_apt <file>: Resolves package list from file, cuts any comments (denoted by%), and runsapt-get installwithout recommended packages. -
install_pip <file>/install_conda <file>/install_mamba <file>: Installs libraries using corresponding CLI from clean package list inputs. -
install__clean: Removes all temporary files, cleansapt-getcache and autoremoves unused dependencies, purgesnpmcache, runsconda/mambacleanups, deletes python compiled cache (__pycache__and*.py[co]), and clears/tmp/. Always invoke this at the end of any setup run. -
fix_permission <group_id> <directories...>: Recursively grants read-write-execute permissions to a given group ID (default0for root/admin processes) to allow multi-user container access.
The base image inherits from atom and installs tini, micromamba, conda, pip, python, and uv.
Downloads the designated architecture-specific tini binary from GitHub and installs it at /usr/bin/tini. It functions as PID 1 to handle signal forwarding and orphan reaping.
-
setup_mamba: Downloadsmicromambafrom Snakepit and configures/etc/conda/.condarcwith theconda-forgechannel. -
setup_conda_with_mamba <version>: Standardizes Python base package installation. It installsconda,pip, and the requestedpythonversion directly.
If SYS_PY_REPLACE is set to true, the installation script replaces the system's python default to target conda's python:
- Locates default OS Python via
py3versions. - Replaces the default Python string in
/usr/share/python3/debian_defaults. - Injects a
.pthfile (usr_share.pth) into python's site-packages referencing/usr/share/pysharedand/usr/share/python3/directories. - Moves OS default
dist-packagesto root, deletes old system Python directories, and symlinks/usr/lib/python<VER>to Conda's library prefix. - Symlinks
/usr/bin/python,/usr/bin/python3,/usr/bin/pipto target Conda's bin folders.