Skip to content

Commit b10776b

Browse files
committed
[UPDATE][v2.4.5] Restore Python; Fix Rust Installtion; Remove create-shared-dir
1 parent a0768ca commit b10776b

7 files changed

Lines changed: 82 additions & 50 deletions

File tree

Dockerfile.cpu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ LABEL maintainer="JamesNULLiu jamesnulliu@gmail.com"
1616
LABEL version=${IMAGE_VERSION}
1717

1818
ENV IMAGE_NAME=${IMAGE_NAME}
19+
ENV ENV_SETUP_FILE=/etc/local/env_setup.sh
1920
ENV VCPKG_ROOT=/opt/vcpkg
2021
ENV VCPKG_HOME=/opt/vcpkg
2122
ENV UV_HOME=/opt/uv
22-
ENV ENV_SETUP_FILE=/etc/local/env_setup.sh
23+
ENV CARGO_HOME=/usr/local/cargo
24+
ENV RUSTUP_HOME=/usr/local/rustup
2325

2426
SHELL ["/bin/bash", "-c"]
2527

@@ -62,8 +64,8 @@ RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \
6264
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format && \
6365
ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb
6466

65-
# Rust
66-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
67+
# Install Rust
68+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
6769

6870
# Config files
6971
COPY data/vimrc.local /etc/vim/vimrc.local
@@ -78,8 +80,6 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | \
7880

7981
# Some final steps
8082
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 && \
8383
apt-get autoremove -y && \
8484
apt-get clean && rm -rf /var/lib/apt/lists/* && \
8585
git config --system --unset-all user.name || true && \

Dockerfile.cuda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ LABEL maintainer="JamesNULLiu jamesnulliu@gmail.com"
1515
LABEL version=${IMAGE_VERSION}
1616

1717
ENV IMAGE_NAME=${IMAGE_NAME}
18+
ENV ENV_SETUP_FILE=/etc/local/env_setup.sh
1819
ENV CUDA_HOME=/usr/local/cuda
1920
ENV VCPKG_ROOT=/opt/vcpkg
2021
ENV VCPKG_HOME=/opt/vcpkg
2122
ENV UV_HOME=/opt/uv
22-
ENV ENV_SETUP_FILE=/etc/local/env_setup.sh
23+
ENV CARGO_HOME=/usr/local/cargo
24+
ENV RUSTUP_HOME=/usr/local/rustup
2325

2426
SHELL ["/bin/bash", "-c"]
2527

@@ -62,8 +64,8 @@ RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \
6264
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format && \
6365
ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb
6466

65-
# Rust
66-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
67+
# Install Rust
68+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
6769

6870
# Config files
6971
COPY data/vimrc.local /etc/vim/vimrc.local
@@ -78,8 +80,6 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | \
7880

7981
# Some final steps
8082
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 && \
8383
apt-get autoremove -y && \
8484
apt-get clean && rm -rf /var/lib/apt/lists/* && \
8585
git config --system --unset-all user.name || true && \

data/env_setup.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,21 @@ if [ -d "${UV_HOME:-}" ]; then
7171
env_load PATH "$UV_HOME"
7272
echo "[ENV-SETUP] UV initialized from $UV_HOME"
7373
## You can uncomment the following line to set a shared cache dir for UV.
74-
## Make sure to run `sudo create-shared-dir <group> $UV_CACHE_DIR` ONLY ONCE.
7574
# export UV_CACHE_DIR="$UV_HOME/.cache"
7675
# export UV_PYTHON_INSTALL_DIR="$UV_HOME/python"
7776
echo " |- UV_CACHE_DIR: ${UV_CACHE_DIR:-<not set>}"
7877
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
9078
else
9179
unset UV_HOME
80+
fi
81+
82+
if [ -d "${CARGO_HOME:-}" ] && [ -d "${RUSTUP_HOME:-}" ]; then
83+
alias LOAD_RUST="env_load PATH $CARGO_HOME/bin"
84+
alias UNLOAD_RUST="env_unload PATH $CARGO_HOME/bin"
85+
# Load Rust by default
86+
env_load PATH "$CARGO_HOME/bin"
87+
echo "[ENV-SETUP] Rust initialized from $CARGO_HOME and $RUSTUP_HOME"
88+
else
89+
unset CARGO_HOME
90+
unset RUSTUP_HOME
9291
fi

scripts/build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/bash
2-
31
set -e
42

53
DOCKER_FILE=$1

scripts/exec.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/bash
2-
31
CONTAINER_NAME=$1
42

53
if [ ! $CONTAINER_NAME ]; then

scripts/image-configs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IMAGE_VERSION=2.4.4
1+
IMAGE_VERSION=2.4.5
22
CUDA_VERSION=12.8.0
33
UBUNTU_VERSION=24.04
44
LLVM_VERSION=20

scripts/run.sh

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,74 @@
22

33
set -e
44

5-
IMAGE_NAME=$1
6-
CONTAINER_NAME=$2
75

8-
if [ ! $IMAGE_NAME ]; then
9-
echo "Usage: $0 <image_name> [container_name]"
10-
exit 1
11-
fi
6+
IMAGE_NAME=""
7+
CONTAINER_NAME="tmp"
8+
TMP="false"
9+
10+
function print_help() {
11+
echo "Usage: $0 [options]"
12+
echo "Options:"
13+
echo " -h, --help Show this help message and exit"
14+
echo " -i, --image-name Name of the Docker image to use (required)"
15+
echo " -c, --container-name Name of the Docker container (default: tmp)"
16+
echo " --tmp Create a temporary container and attach to it;"
17+
echo " The container would be removed after exit"
18+
}
19+
20+
while [[ $# -gt 0 ]]; do
21+
case $1 in
22+
-I|--image-name)
23+
IMAGE_NAME="$2"; shift ;;
24+
-C|--container-name)
25+
CONTAINER_NAME="$2"; shift ;;
26+
--tmp)
27+
TMP="true" ;;
28+
-h|--help)
29+
print_help; exit 0 ;;
30+
*)
31+
echo "[build.sh] ERROR: Unknown argument: $1"
32+
print_help; exit 1 ;;
33+
esac
34+
shift
35+
done
36+
1237

13-
if [ ! $CONTAINER_NAME ]; then
14-
CONTAINER_NAME=tmp
38+
if [ -z "$IMAGE_NAME" ]; then
39+
echo "[run.sh] ERROR: Image name is required. Use -i or --image-name to specify it."
40+
exit 1
1541
fi
1642

17-
if [[ "$IMAGE_NAME" == *"cuda"* ]]; then
18-
docker run -td \
43+
if [ "$TMP" = "true" ]; then
44+
docker run -it --rm \
1945
--name $CONTAINER_NAME \
2046
--gpus all \
21-
--network=host \
22-
--shm-size=16G \
47+
--network host \
48+
--shm-size 20G \
2349
--hostname $CONTAINER_NAME \
2450
-v /home:/home \
25-
$IMAGE_NAME
51+
$IMAGE_NAME /bin/bash
2652
else
27-
docker run -td \
28-
--name $CONTAINER_NAME \
29-
--network=host \
30-
--shm-size=16G \
31-
--hostname $CONTAINER_NAME \
32-
-v /home:/home \
33-
$IMAGE_NAME
53+
if [[ "$IMAGE_NAME" == *"cuda"* ]]; then
54+
docker run -td \
55+
--name $CONTAINER_NAME \
56+
--gpus all \
57+
--network host \
58+
--shm-size 20G \
59+
--hostname $CONTAINER_NAME \
60+
-v /home:/home \
61+
$IMAGE_NAME
62+
else
63+
docker run -td \
64+
--name $CONTAINER_NAME \
65+
--network host \
66+
--shm-size 20G \
67+
--hostname $CONTAINER_NAME \
68+
-v /home:/home \
69+
$IMAGE_NAME
70+
fi
71+
docker cp $HOME/.ssh $CONTAINER_NAME:/root/
72+
docker start $CONTAINER_NAME
73+
docker exec $CONTAINER_NAME chown -R root:root /root/.ssh
3474
fi
3575

36-
docker cp $HOME/.ssh $CONTAINER_NAME:/root/
37-
docker start $CONTAINER_NAME
38-
docker exec $CONTAINER_NAME chown -R root:root /root/.ssh

0 commit comments

Comments
 (0)