Skip to content

Commit 032dd0d

Browse files
authored
Merge pull request #46 from Alliance-Algorithm/refactor/update-docker-image
Update docker image, switch toolchain to llvm-22 with cmake-4.2
2 parents debc58c + d42ce35 commit 032dd0d

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

Dockerfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
8282
openssh-client \
8383
lsb-release software-properties-common gnupg sudo \
8484
python3-colorama python3-dpkt && \
85-
wget -O ./llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key && \
86-
apt-key add ./llvm-snapshot.gpg.key && \
87-
rm ./llvm-snapshot.gpg.key && \
88-
echo "deb https://apt.llvm.org/noble/ llvm-toolchain-noble main" > /etc/apt/sources.list.d/llvm-apt.list && \
89-
apt-get update && \
90-
version=`apt-cache search clangd- | grep clangd- | awk -F' ' '{print $1}' | sort -V | tail -1 | cut -d- -f2` && \
91-
apt-get install -y --no-install-recommends clangd-$version && \
9285
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 50 && \
9386
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 50 && \
94-
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-$version 50 && \
9587
apt-get autoremove -y && apt-get clean && \
9688
rm -rf /var/lib/apt/lists/* /tmp/*
9789

90+
# Install latest stable llvm-toolchain
91+
RUN mkdir -p /etc/apt/keyrings && \
92+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg -o /etc/apt/keyrings/llvm-snapshot.gpg --dearmor && \
93+
echo "deb [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] https://mirrors.tuna.tsinghua.edu.cn/llvm-apt/noble/ llvm-toolchain-noble-22 main" \
94+
| tee /etc/apt/sources.list.d/llvm.list && \
95+
apt-get update && \
96+
apt-get install -y --no-install-recommends clang-22 clangd-22 clang-format-22 lldb-22 && \
97+
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 100 && \
98+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 100 && \
99+
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-22 100 && \
100+
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-22 100 && \
101+
update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-22 100 && \
102+
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
103+
98104
# Generate/load ssh key and setup unison
99105
RUN --mount=type=bind,target=/tmp/.ssh,source=.ssh,readonly=false \
100106
cd /home/ubuntu && mkdir -p .ssh && \
@@ -111,6 +117,11 @@ RUN curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linu
111117
tar -C /opt -xzf nvim-linux-x86_64.tar.gz && \
112118
rm nvim-linux-x86_64.tar.gz
113119

120+
# Install latest stable cmake for user ubuntu
121+
RUN wget https://github.com/kitware/cmake/releases/download/v4.2.3/cmake-4.2.3-linux-x86_64.sh -O install.sh && \
122+
mkdir -p /opt/cmake/ && bash install.sh --skip-license --prefix=/opt/cmake/ --exclude-subdir && \
123+
rm install.sh
124+
114125
# Change user
115126
RUN chsh -s /bin/zsh ubuntu && \
116127
echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
@@ -124,12 +135,14 @@ RUN sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools
124135
sed -i 's/ZSH_THEME=\"[a-z0-9\-]*\"/ZSH_THEME="af-magic"/g' ~/.zshrc && \
125136
echo 'source ~/env_setup.zsh' >> ~/.zshrc && \
126137
echo 'export PATH="${PATH}:/opt/nvim-linux-x86_64/bin"' >> ~/.zshrc && \
138+
# echo 'export PATH="${PATH}:/opt/cmake/bin"' >> ~/.zshrc && \
127139
echo 'export PATH="${PATH}:${RMCS_PATH}/.script"' >> ~/.zshrc
128140

129141
# Copy environment setup scripts
130142
COPY --chown=1000:1000 .script/template/env_setup.bash env_setup.bash
131143
COPY --chown=1000:1000 .script/template/env_setup.zsh env_setup.zsh
132144

145+
133146
# Runtime container, will automatically launch the main program
134147
FROM rmcs-base AS rmcs-runtime
135148

docker-compose.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
services:
22
rmcs-develop:
33
image: qzhhhi/rmcs-develop:latest
4-
user: "${CONTAINER_USER}"
5-
privileged: true
6-
command: >
7-
bash -c "
8-
sudo chown -R ${CONTAINER_USER}:${CONTAINER_USER} ${CONTAINER_HOME}/.config
9-
exec bash
10-
"
4+
user: "1000:1000"
115
volumes:
126
- /dev:/dev:bind
137
- /tmp/.X11-unix:/tmp/.X11-unix:bind
14-
- /run/user/1000/wayland-0:/run/user/1000/wayland-0
8+
- /run/user/1000/wayland-0:/run/user/1000/wayland-0:bind
159
- ${HOST_NVIM_DIR}:${CONTAINER_HOME}/.config/nvim/:bind
1610
- .:/workspaces/RMCS:bind
1711
environment:
1812
- DISPLAY=${DISPLAY}
1913
- WAYLAND_DISPLAY=${WAYLAND_DISPLAY}
2014
network_mode: host
2115
tty: true
22-
stdin_open: true
23-
16+
stdin_open: true

0 commit comments

Comments
 (0)