Skip to content

Commit a0768ca

Browse files
committed
[update] Enhance scripts && Remove System Python
1 parent 22c0cfe commit a0768ca

6 files changed

Lines changed: 42 additions & 31 deletions

File tree

Dockerfile.cpu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | \
7777
env UV_INSTALL_DIR="${UV_HOME}" UV_NO_MODIFY_PATH=1 sh
7878

7979
# Some final steps
80-
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y && \
80+
RUN apt-get update && apt-get upgrade -y && \
81+
# Remove system python3.12, force to use uv managed python
82+
apt-get remove -y python3 python3.12 && \
83+
apt-get autoremove -y && \
8184
apt-get clean && rm -rf /var/lib/apt/lists/* && \
8285
git config --system --unset-all user.name || true && \
8386
git config --system --unset-all user.email || true && \

Dockerfile.cuda

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | \
7777
env UV_INSTALL_DIR="${UV_HOME}" UV_NO_MODIFY_PATH=1 sh
7878

7979
# Some final steps
80-
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y && \
80+
RUN apt-get update && apt-get upgrade -y && \
81+
# Remove system python3.12, force to use uv managed python
82+
apt-get remove -y python3 python3.12 && \
83+
apt-get autoremove -y && \
8184
apt-get clean && rm -rf /var/lib/apt/lists/* && \
8285
git config --system --unset-all user.name || true && \
8386
git config --system --unset-all user.email || true && \

data/create-shared-dir

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ set -e
2121
#
2222
# ==============================================================================
2323

24-
# --- Argument Parsing ---
25-
SHARED_GROUP="$1"
26-
shift # Shift arguments so $@ contains only the directories
27-
TARGET_DIRS=("$@")
28-
2924
# --- Input Validation ---
30-
if [ ${#TARGET_DIRS[@]} -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
31-
echo "Usage: $0 <shared_group> <dir1> [<dir2> ...]"
25+
if [ $# -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
26+
echo "Usage: $0 <user_group> <dir1> [<dir2> ...]"
3227
exit 1
3328
fi
3429

30+
if [ $# -lt 2 ]; then
31+
echo "Error: Missing directory arguments."
32+
echo "Usage: $0 <user_group> <dir1> [<dir2> ...]"
33+
exit 1
34+
fi
35+
36+
# --- Argument Parsing ---
37+
USER_GROUP="$1"
38+
shift
39+
TARGET_DIRS=("$@")
40+
3541
# --- Pre-flight Checks ---
3642
# 1. Check for root privileges.
3743
if [[ $EUID -ne 0 ]]; then
@@ -40,22 +46,22 @@ if [[ $EUID -ne 0 ]]; then
4046
fi
4147

4248
# 2. Check if the specified group exists.
43-
if ! getent group "$SHARED_GROUP" > /dev/null; then
44-
echo "Error: Group '$SHARED_GROUP' does not exist." >&2
49+
if ! getent group "$USER_GROUP" > /dev/null; then
50+
echo "Error: Group '$USER_GROUP' does not exist." >&2
4551
exit 1
4652
fi
4753

4854
# --- Main Logic ---
49-
echo "Configuring shared directories for group '$SHARED_GROUP'..."
55+
echo "Configuring shared directories for group '$USER_GROUP'..."
5056

5157
for target_dir in "${TARGET_DIRS[@]}"; do
5258
echo "--> Processing: $target_dir"
5359
mkdir -p "$target_dir"
54-
chgrp -R "$SHARED_GROUP" "$target_dir"
60+
chgrp -R "$USER_GROUP" "$target_dir"
5561
chmod -R g=rwX,o-rwx "$target_dir"
5662
find "$target_dir" -type d -exec chmod g+s {} +
57-
setfacl -R -m "g:$SHARED_GROUP:rwX" "$target_dir"
58-
setfacl -R -d -m "g:$SHARED_GROUP:rwX" "$target_dir"
63+
setfacl -R -m "g:$USER_GROUP:rwX" "$target_dir"
64+
setfacl -R -d -m "g:$USER_GROUP:rwX" "$target_dir"
5965
done
6066

6167
echo "Configuration complete."

data/env_setup.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ if [ -d "${UV_HOME:-}" ]; then
7070
alias UNLOAD_UV="env_unload PATH $UV_HOME"
7171
env_load PATH "$UV_HOME"
7272
echo "[ENV-SETUP] UV initialized from $UV_HOME"
73-
cat << 'EOF'
74-
|- NOTE: For managing shared UV cache and python directory:
75-
|- 1. Export UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR to a target directory.
76-
| (No need to create them first.)
77-
|- 2. Run command below ONLY ONCE to create the shared directories:
78-
| $ create-shared-dir <group> ${UV_CACHE_DIR} ${UV_PYTHON_INSTALL_DIR}
79-
|- 3. For all users in <group>, make sure UV_CACHE_DIR and
80-
| UV_PYTHON_INSTALL_DIR are exported properly.
81-
| You can do this in ${ENV_SETUP_FILE} for convenience.
82-
|- 4. Remove this NOTE from ${ENV_SETUP_FILE} if you want.
83-
EOF
8473
## You can uncomment the following line to set a shared cache dir for UV.
8574
## Make sure to run `sudo create-shared-dir <group> $UV_CACHE_DIR` ONLY ONCE.
8675
# export UV_CACHE_DIR="$UV_HOME/.cache"
8776
# export UV_PYTHON_INSTALL_DIR="$UV_HOME/python"
88-
echo "|- UV_CACHE_DIR: ${UV_CACHE_DIR:-<not set>}"
89-
echo "|- UV_PYTHON_INSTALL_DIR: ${UV_PYTHON_INSTALL_DIR:-<not set>}"
77+
echo " |- UV_CACHE_DIR: ${UV_CACHE_DIR:-<not set>}"
78+
echo " |- UV_PYTHON_INSTALL_DIR: ${UV_PYTHON_INSTALL_DIR:-<not set>}"
79+
cat << 'EOF'
80+
NOTE: For managing shared UV cache and python directory:
81+
1. Export UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR to a target directory.
82+
(No need to create them first.)
83+
2. Run command below ONLY ONCE to create the shared directories:
84+
$ create-shared-dir <group> ${UV_CACHE_DIR} ${UV_PYTHON_INSTALL_DIR}
85+
3. For all users in <group>, make sure UV_CACHE_DIR and
86+
UV_PYTHON_INSTALL_DIR are exported properly.
87+
You can do this in ${ENV_SETUP_FILE} for convenience.
88+
4. Remove this NOTE from ${ENV_SETUP_FILE} if you want.
89+
EOF
9090
else
9191
unset UV_HOME
9292
fi

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ docker build \
1818
-f $DOCKER_FILE \
1919
--build-arg IMAGE_VERSION=$IMAGE_VERSION \
2020
--build-arg IMAGE_NAME=$IMAGE_NAME \
21-
--build-arg CUDA_VERSION=$CUDA_VERSION \
2221
--build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
2322
--build-arg LLVM_VERSION=$LLVM_VERSION \
23+
--build-arg CUDA_VERSION=$CUDA_VERSION \
2424
-t $IMAGE_NAME \
2525
.
2626

scripts/image-configs.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
IMAGE_VERSION=2.4.3
2-
TORCH_VERSION=2.7.1
1+
IMAGE_VERSION=2.4.4
32
CUDA_VERSION=12.8.0
43
UBUNTU_VERSION=24.04
54
LLVM_VERSION=20

0 commit comments

Comments
 (0)