Skip to content

Commit 4d18f7f

Browse files
committed
[build] release Docker images v2.5.1
Dockerfile.cpu: move shared package and toolchain setup into install-common.sh and adopt stricter bash shell options. Dockerfile.cuda: move shared package and toolchain setup into install-common.sh and adopt stricter bash shell options. data/install-common.sh: add shared installer for base packages, vcpkg, LLVM, Rust, uv, AI CLIs, and optional timezone setup. data/entrypoint.sh: enable strict mode and apply TZ when provided at container startup. data/env_setup.sh: stop exporting locale defaults and surface TZ guidance for interactive shells. scripts/build.sh: add help text, validation, shared image-name resolution, and optional TZ build args. scripts/exec.sh: add help text, safer defaults, exact-name matching, and strict shell handling. scripts/image-configs.sh: add repository-aware image resolution helpers and bump IMAGE_VERSION to 2.5.1. scripts/run.sh: add argument validation, optional timezone and GPU controls, safer SSH copy handling, and improved help output. scripts/create-shared-dir: move the shared-dir helper into scripts/ and add usage and host prerequisite guidance. data/create-shared-dir: remove the legacy helper location.
1 parent 7274819 commit 4d18f7f

10 files changed

Lines changed: 446 additions & 209 deletions

File tree

Dockerfile.cpu

Lines changed: 7 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ ARG UBUNTU_VERSION=24.04
44
FROM ubuntu:${UBUNTU_VERSION}
55

66
ARG DEBIAN_FRONTEND=noninteractive
7-
ENV LANGUAGE=en_US.UTF-8
8-
ENV LANG=en_US.UTF-8
9-
ENV LC_ALL=en_US.UTF-8
10-
11-
ARG INSTALL_TORCH
7+
ARG TZ
128
ARG LLVM_VERSION
139
ARG IMAGE_VERSION
1410
ARG IMAGE_NAME
@@ -24,74 +20,20 @@ ENV UV_HOME=/opt/uv
2420
ENV CARGO_HOME=/usr/local/cargo
2521
ENV RUSTUP_HOME=/usr/local/rustup
2622

27-
SHELL ["/bin/bash", "-c"]
28-
29-
# Some basic tools
30-
RUN apt-get update && apt-get upgrade -y && \
31-
apt-get install -y \
32-
apt-utils lsb-release software-properties-common gnupg git acl sed\
33-
vim-gtk3 wget p7zip-full ninja-build curl jq nodejs npm pkg-config ssh ccache \
34-
build-essential gdb htop tmux kmod \
35-
libssl-dev && \
36-
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" \
37-
| debconf-set-selections && \
38-
apt-get --reinstall install -y ttf-mscorefonts-installer && fc-cache -f -v
39-
40-
# Vcpkg
41-
RUN git clone https://github.com/microsoft/vcpkg.git ${VCPKG_HOME} && \
42-
cd ${VCPKG_HOME} && ./bootstrap-vcpkg.sh
43-
44-
# CMake
45-
RUN wget -O /tmp/kitware-archive.sh \
46-
https://apt.kitware.com/kitware-archive.sh && \
47-
bash /tmp/kitware-archive.sh && \
48-
apt-get update && apt-get install -y cmake
49-
50-
# LLVM
51-
RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \
52-
chmod +x /tmp/llvm.sh && \
53-
/tmp/llvm.sh ${LLVM_VERSION} && \
54-
apt-get update && apt-get install -y \
55-
clang-${LLVM_VERSION} lldb-${LLVM_VERSION} \
56-
clang-tools-${LLVM_VERSION} libclang-${LLVM_VERSION}-dev \
57-
clang-format-${LLVM_VERSION} libomp-${LLVM_VERSION}-dev \
58-
clangd-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} \
59-
lldb-${LLVM_VERSION} libc++-${LLVM_VERSION}-dev \
60-
libc++abi-${LLVM_VERSION}-dev && \
61-
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
62-
ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ && \
63-
ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd && \
64-
ln -s /usr/bin/clang-tidy-${LLVM_VERSION} /usr/bin/clang-tidy && \
65-
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format && \
66-
ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb
67-
68-
# Install Rust
69-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
70-
71-
# Install AI coding CLIs
72-
RUN npm install -g @openai/codex @anthropic-ai/claude-code \
73-
&& npm cache clean --force
23+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
7424

7525
# Config files
26+
COPY data/install-common.sh /usr/local/bin/install-common.sh
7627
COPY data/vimrc.local /etc/vim/vimrc.local
7728
COPY data/env_setup.sh ${ENV_SETUP_FILE}
7829
COPY data/.inputrc data/.bashrc data/.bash_profile data/.tmux.conf /root/
7930
COPY data/.inputrc data/.bashrc data/.bash_profile data/.tmux.conf /etc/skel/
8031

81-
# Install uv
82-
RUN curl -LsSf https://astral.sh/uv/install.sh | \
83-
env UV_INSTALL_DIR="${UV_HOME}" UV_NO_MODIFY_PATH=1 sh
84-
85-
# Some final steps
86-
RUN apt-get update && apt-get upgrade -y && \
87-
apt-get autoremove -y && \
88-
apt-get clean && rm -rf /var/lib/apt/lists/* && \
89-
git config --system --unset-all user.name || true && \
90-
git config --system --unset-all user.email || true && \
91-
git config --global --unset-all user.name || true && \
92-
git config --global --unset-all user.email || true
32+
RUN chmod +x /usr/local/bin/install-common.sh && \
33+
/usr/local/bin/install-common.sh && \
34+
rm -f /usr/local/bin/install-common.sh
9335

9436
COPY data/entrypoint.sh /usr/local/bin/entrypoint.sh
9537
RUN chmod +x /usr/local/bin/entrypoint.sh
9638
ENTRYPOINT [ "entrypoint.sh" ]
97-
CMD [ "bash" ]
39+
CMD [ "bash" ]

Dockerfile.cuda

Lines changed: 7 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ ARG UBUNTU_VERSION=24.04
44
FROM nvidia/cuda:${CUDA_VERSION}-cudnn-devel-ubuntu${UBUNTU_VERSION}
55

66
ARG DEBIAN_FRONTEND=noninteractive
7-
ENV LANGUAGE=en_US.UTF-8
8-
ENV LANG=en_US.UTF-8
9-
7+
ARG TZ
108
ARG LLVM_VERSION
119
ARG IMAGE_VERSION
1210
ARG IMAGE_NAME
@@ -23,74 +21,20 @@ ENV UV_HOME=/opt/uv
2321
ENV CARGO_HOME=/usr/local/cargo
2422
ENV RUSTUP_HOME=/usr/local/rustup
2523

26-
SHELL ["/bin/bash", "-c"]
27-
28-
# Some basic tools
29-
RUN apt-get update && apt-get upgrade -y && \
30-
apt-get install -y \
31-
apt-utils lsb-release software-properties-common gnupg git acl sed \
32-
vim-gtk3 wget p7zip-full ninja-build curl jq nodejs npm pkg-config ssh ccache \
33-
build-essential gdb htop tmux kmod \
34-
libssl-dev && \
35-
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" \
36-
| debconf-set-selections && \
37-
apt-get --reinstall install -y ttf-mscorefonts-installer && fc-cache -f -v
38-
39-
# Vcpkg
40-
RUN git clone https://github.com/microsoft/vcpkg.git ${VCPKG_HOME} && \
41-
cd ${VCPKG_HOME} && ./bootstrap-vcpkg.sh
42-
43-
# CMake
44-
RUN wget -O /tmp/kitware-archive.sh \
45-
https://apt.kitware.com/kitware-archive.sh && \
46-
bash /tmp/kitware-archive.sh && \
47-
apt-get update && apt-get install -y cmake
48-
49-
# LLVM
50-
RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \
51-
chmod +x /tmp/llvm.sh && \
52-
/tmp/llvm.sh ${LLVM_VERSION} && \
53-
apt-get update && apt-get install -y \
54-
clang-${LLVM_VERSION} lldb-${LLVM_VERSION} \
55-
clang-tools-${LLVM_VERSION} libclang-${LLVM_VERSION}-dev \
56-
clang-format-${LLVM_VERSION} libomp-${LLVM_VERSION}-dev \
57-
clangd-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} \
58-
lldb-${LLVM_VERSION} libc++-${LLVM_VERSION}-dev \
59-
libc++abi-${LLVM_VERSION}-dev && \
60-
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
61-
ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ && \
62-
ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd && \
63-
ln -s /usr/bin/clang-tidy-${LLVM_VERSION} /usr/bin/clang-tidy && \
64-
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format && \
65-
ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb
66-
67-
# Install Rust
68-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
69-
70-
# Install AI coding CLIs
71-
RUN npm install -g @openai/codex @anthropic-ai/claude-code \
72-
&& npm cache clean --force
24+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
7325

7426
# Config files
27+
COPY data/install-common.sh /usr/local/bin/install-common.sh
7528
COPY data/vimrc.local /etc/vim/vimrc.local
7629
COPY data/env_setup.sh ${ENV_SETUP_FILE}
7730
COPY data/.inputrc data/.bashrc data/.tmux.conf data/.bash_profile /root/
7831
COPY data/.inputrc data/.bashrc data/.tmux.conf data/.bash_profile /etc/skel/
7932

80-
# Install uv
81-
RUN curl -LsSf https://astral.sh/uv/install.sh | \
82-
env UV_INSTALL_DIR="${UV_HOME}" UV_NO_MODIFY_PATH=1 sh
83-
84-
# Some final steps
85-
RUN apt-get update && apt-get upgrade -y && \
86-
apt-get autoremove -y && \
87-
apt-get clean && rm -rf /var/lib/apt/lists/* && \
88-
git config --system --unset-all user.name || true && \
89-
git config --system --unset-all user.email || true && \
90-
git config --global --unset-all user.name || true && \
91-
git config --global --unset-all user.email || true
33+
RUN chmod +x /usr/local/bin/install-common.sh && \
34+
/usr/local/bin/install-common.sh && \
35+
rm -f /usr/local/bin/install-common.sh
9236

9337
COPY data/entrypoint.sh /usr/local/bin/entrypoint.sh
9438
RUN chmod +x /usr/local/bin/entrypoint.sh
9539
ENTRYPOINT [ "entrypoint.sh" ]
96-
CMD [ "bash" ]
40+
CMD [ "bash" ]

data/entrypoint.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if [ -n "${TZ:-}" ] && [ -f "/usr/share/zoneinfo/${TZ}" ]; then
6+
ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime
7+
echo "${TZ}" > /etc/timezone
8+
fi
29

310
if [[ $# -eq 0 ]]; then
411
exec "/bin/bash"
512
else
613
exec "$@"
7-
fi
14+
fi

data/env_setup.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ FILE_PATH="$FILE_DIR/$FILE_NAME"
2222
echo "[ENV-SETUP] Sourcing ${FILE_PATH}"
2323
echo " Current \${ENV_SETUP_FILE}: ${ENV_SETUP_FILE:-<not set>}"
2424

25-
export LANG=en_US.UTF-8
26-
export LC_ALL=en_US.UTF-8
27-
echo "[ENV-SETUP] Setting LANG to ${LANG}, LC_ALL to ${LC_ALL}"
28-
2925
# @brief Add `$1` into environment variable `$2` if it is not already there.
3026
# @example > env_load PATH /usr/local/bin
3127
env_load() {
@@ -51,6 +47,12 @@ env_unload() {
5147
export $var_name=$(IFS=:; echo "${new_paths[*]}")
5248
}
5349

50+
# Time zone:
51+
# To set a default time zone for interactive shells, edit this file manually
52+
# and uncomment the following line with your preferred value.
53+
# export TZ="Etc/UTC"
54+
echo "[ENV-SETUP] Current TZ: ${TZ:-<not set>}"
55+
5456
if [ -d "${CUDA_HOME:-}" ]; then
5557
alias LOAD_CUDA="env_load PATH $CUDA_HOME/bin && \
5658
env_load LD_LIBRARY_PATH $CUDA_HOME/lib64"
@@ -97,4 +99,4 @@ if [ -d "${CARGO_HOME:-}" ] && [ -d "${RUSTUP_HOME:-}" ]; then
9799
else
98100
unset CARGO_HOME
99101
unset RUSTUP_HOME
100-
fi
102+
fi

data/install-common.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
print_help() {
6+
cat <<'EOF'
7+
Usage: /usr/local/bin/install-common.sh
8+
9+
Install the shared toolchain and utilities used by both Docker image variants.
10+
11+
Environment:
12+
LLVM_VERSION LLVM major version to install. Required.
13+
VCPKG_HOME Target directory for vcpkg. Required.
14+
UV_HOME Target directory for uv. Required.
15+
TZ Optional timezone name to configure, for example Etc/UTC.
16+
EOF
17+
}
18+
19+
case "${1:-}" in
20+
-h|--help)
21+
print_help
22+
exit 0
23+
;;
24+
esac
25+
26+
export DEBIAN_FRONTEND="${DEBIAN_FRONTEND:-noninteractive}"
27+
28+
apt-get update
29+
apt-get install -y --no-install-recommends \
30+
apt-utils \
31+
lsb-release \
32+
software-properties-common \
33+
gnupg \
34+
git \
35+
acl \
36+
sed \
37+
vim-gtk3 \
38+
wget \
39+
p7zip-full \
40+
ninja-build \
41+
curl \
42+
jq \
43+
nodejs \
44+
npm \
45+
pkg-config \
46+
openssh-client \
47+
ccache \
48+
build-essential \
49+
gdb \
50+
htop \
51+
tmux \
52+
kmod \
53+
bubblewrap \
54+
libssl-dev \
55+
tzdata \
56+
ca-certificates
57+
58+
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" \
59+
| debconf-set-selections
60+
apt-get install -y --no-install-recommends ttf-mscorefonts-installer
61+
fc-cache -f -v
62+
63+
if [ -n "${TZ:-}" ]; then
64+
ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime
65+
echo "${TZ}" > /etc/timezone
66+
fi
67+
68+
git clone https://github.com/microsoft/vcpkg.git "${VCPKG_HOME}"
69+
pushd "${VCPKG_HOME}"
70+
./bootstrap-vcpkg.sh
71+
popd
72+
73+
wget -O /tmp/kitware-archive.sh https://apt.kitware.com/kitware-archive.sh
74+
bash /tmp/kitware-archive.sh
75+
apt-get update
76+
apt-get install -y --no-install-recommends cmake
77+
78+
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh
79+
chmod +x /tmp/llvm.sh
80+
/tmp/llvm.sh "${LLVM_VERSION}"
81+
apt-get update
82+
apt-get install -y --no-install-recommends \
83+
"clang-${LLVM_VERSION}" \
84+
"lldb-${LLVM_VERSION}" \
85+
"clang-tools-${LLVM_VERSION}" \
86+
"libclang-${LLVM_VERSION}-dev" \
87+
"clang-format-${LLVM_VERSION}" \
88+
"libomp-${LLVM_VERSION}-dev" \
89+
"clangd-${LLVM_VERSION}" \
90+
"clang-tidy-${LLVM_VERSION}" \
91+
"libc++-${LLVM_VERSION}-dev" \
92+
"libc++abi-${LLVM_VERSION}-dev"
93+
94+
ln -sf "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang
95+
ln -sf "/usr/bin/clang++-${LLVM_VERSION}" /usr/bin/clang++
96+
ln -sf "/usr/bin/clangd-${LLVM_VERSION}" /usr/bin/clangd
97+
ln -sf "/usr/bin/clang-tidy-${LLVM_VERSION}" /usr/bin/clang-tidy
98+
ln -sf "/usr/bin/clang-format-${LLVM_VERSION}" /usr/bin/clang-format
99+
ln -sf "/usr/bin/lldb-${LLVM_VERSION}" /usr/bin/lldb
100+
101+
curl https://sh.rustup.rs -sSf | sh -s -- -y
102+
103+
npm install -g @openai/codex @anthropic-ai/claude-code
104+
npm cache clean --force
105+
106+
curl -LsSf https://astral.sh/uv/install.sh | \
107+
env UV_INSTALL_DIR="${UV_HOME}" UV_NO_MODIFY_PATH=1 sh
108+
109+
apt-get autoremove -y
110+
apt-get clean
111+
rm -rf /var/lib/apt/lists/*
112+
rm -f /tmp/kitware-archive.sh /tmp/llvm.sh
113+
114+
git config --system --unset-all user.name || true
115+
git config --system --unset-all user.email || true
116+
git config --global --unset-all user.name || true
117+
git config --global --unset-all user.email || true

0 commit comments

Comments
 (0)