Skip to content

Commit 41a1926

Browse files
authored
Update devcontainer.json and reuse ci docker images (#1791)
<!-- .github/pull_request_template.md --> ## 📌 Description This PR updates the devcontainer.json config and reuses the ci docker images in dev docker image. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [x] Tests have been added or updated as needed. - [x] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
1 parent d161b56 commit 41a1926

File tree

10 files changed

+359
-70
lines changed

10 files changed

+359
-70
lines changed

.devcontainer/devcontainer.json renamed to .devcontainer/cu126/devcontainer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "CUDA Development Container",
33
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": "."
4+
"dockerfile": "../../docker/Dockerfile.cu126.dev",
5+
"context": "../../docker/"
66
},
77
"runArgs": [
88
"--gpus=all"
@@ -12,8 +12,10 @@
1212
"extensions": [
1313
"llvm-vs-code-extensions.vscode-clangd",
1414
"ms-python.python",
15-
"ms-python.black-formatter",
16-
"nvidia.nsight-vscode-edition"
15+
"nvidia.nsight-vscode-edition",
16+
"xaver.clang-format",
17+
"charliermarsh.ruff",
18+
"matangover.mypy"
1719
]
1820
}
1921
},
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "CUDA Development Container",
3+
"build": {
4+
"dockerfile": "../../docker/Dockerfile.cu128.dev",
5+
"context": "../../docker/"
6+
},
7+
"runArgs": [
8+
"--gpus=all"
9+
],
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"llvm-vs-code-extensions.vscode-clangd",
14+
"ms-python.python",
15+
"nvidia.nsight-vscode-edition",
16+
"xaver.clang-format",
17+
"charliermarsh.ruff",
18+
"matangover.mypy"
19+
]
20+
}
21+
},
22+
"mounts": [
23+
"type=bind,source=${localEnv:HOME}/.ssh,target=/home/devuser/.ssh,readonly"
24+
],
25+
"remoteUser": "devuser"
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "CUDA Development Container",
3+
"build": {
4+
"dockerfile": "../../docker/Dockerfile.cu129.dev",
5+
"context": "../../docker/"
6+
},
7+
"runArgs": [
8+
"--gpus=all"
9+
],
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"llvm-vs-code-extensions.vscode-clangd",
14+
"ms-python.python",
15+
"nvidia.nsight-vscode-edition",
16+
"xaver.clang-format",
17+
"charliermarsh.ruff",
18+
"matangover.mypy"
19+
]
20+
}
21+
},
22+
"mounts": [
23+
"type=bind,source=${localEnv:HOME}/.ssh,target=/home/devuser/.ssh,readonly"
24+
],
25+
"remoteUser": "devuser"
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "CUDA Development Container",
3+
"build": {
4+
"dockerfile": "../../docker/Dockerfile.cu130.dev",
5+
"context": "../../docker/"
6+
},
7+
"runArgs": [
8+
"--gpus=all"
9+
],
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"llvm-vs-code-extensions.vscode-clangd",
14+
"ms-python.python",
15+
"nvidia.nsight-vscode-edition",
16+
"xaver.clang-format",
17+
"charliermarsh.ruff",
18+
"matangover.mypy"
19+
]
20+
}
21+
},
22+
"mounts": [
23+
"type=bind,source=${localEnv:HOME}/.ssh,target=/home/devuser/.ssh,readonly"
24+
],
25+
"remoteUser": "devuser"
26+
}

.devcontainer/install/install_python.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

.devcontainer/install/install_python_packages.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

docker/Dockerfile.cu126.dev

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FROM nvidia/cuda:12.6.0-devel-ubuntu24.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
# Update package lists and install system dependencies
6+
RUN apt-get update && apt-get install -y \
7+
curl \
8+
git \
9+
wget \
10+
clang-format \
11+
clangd-19 \
12+
vim \
13+
zsh \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Install python
17+
COPY install/install_python.sh /install/install_python.sh
18+
RUN bash /install/install_python.sh py312
19+
20+
# Set home directory
21+
WORKDIR /workspace
22+
23+
RUN echo "source activate py312" >> ~/.bashrc
24+
ENV PATH="/opt/conda/bin:$PATH"
25+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26+
27+
# Install torch and other python packages
28+
COPY install/install_python_packages.sh /install/install_python_packages.sh
29+
RUN bash /install/install_python_packages.sh cu126 && pip3 install pre-commit
30+
31+
# Install mpi4py in the conda environment
32+
RUN conda install -n py312 -y mpi4py
33+
34+
# Install oh-my-zsh
35+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
36+
37+
# Install zsh-autosuggestions
38+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
39+
40+
# Configure zsh
41+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
42+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
43+
44+
# Create a non-root user
45+
ARG USERNAME=devuser
46+
ARG USER_UID=1003
47+
ARG USER_GID=$USER_UID
48+
49+
# Create the user
50+
RUN groupadd --gid $USER_GID $USERNAME \
51+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
52+
# [Optional] Add sudo support
53+
&& apt-get update \
54+
&& apt-get install -y sudo \
55+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
56+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
57+
&& rm -rf /var/lib/apt/lists/*
58+
59+
# Remove default 'ubuntu' user (UID 1000) to prevent devcontainer permission conflicts
60+
# Ref: https://github.com/rapidsai/devcontainers/pull/373
61+
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
62+
63+
# Copy zsh configuration to the new user's home
64+
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
65+
cp /root/.zshrc /home/$USERNAME/.zshrc && \
66+
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
67+
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
68+
69+
# Switch to non-root user
70+
USER $USERNAME
71+
WORKDIR /home/$USERNAME
72+
73+
# clangd
74+
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
75+
# conda
76+
ENV PATH="/opt/conda/bin:$PATH"
77+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
78+
79+
# Triton
80+
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"
81+
82+
# Set zsh as default shell
83+
ENV SHELL=/bin/zsh
84+
CMD [ "zsh" ]

.devcontainer/Dockerfile renamed to docker/Dockerfile.cu128.dev

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
FROM nvidia/cuda:12.8.0-devel-ubuntu24.04
22

3+
ENV DEBIAN_FRONTEND=noninteractive
4+
35
# Update package lists and install system dependencies
46
RUN apt-get update && apt-get install -y \
57
curl \
6-
wget \
78
git \
9+
wget \
810
clang-format \
911
clangd-19 \
1012
vim \
1113
zsh \
1214
&& rm -rf /var/lib/apt/lists/*
1315

16+
# Install python
17+
COPY install/install_python.sh /install/install_python.sh
18+
RUN bash /install/install_python.sh py312
19+
20+
# Set home directory
21+
WORKDIR /workspace
22+
23+
RUN echo "source activate py312" >> ~/.bashrc
24+
ENV PATH="/opt/conda/bin:$PATH"
25+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26+
27+
# Install torch and other python packages
28+
COPY install/install_python_packages.sh /install/install_python_packages.sh
29+
RUN bash /install/install_python_packages.sh cu126 && pip3 install pre-commit
30+
31+
# Install mpi4py in the conda environment
32+
RUN conda install -n py312 -y mpi4py
33+
1434
# Install oh-my-zsh
1535
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
1636

@@ -50,24 +70,15 @@ RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
5070
USER $USERNAME
5171
WORKDIR /home/$USERNAME
5272

53-
# Install python
54-
COPY install/install_python.sh /install/install_python.sh
55-
RUN bash /install/install_python.sh py312
56-
5773
# clangd
5874
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
5975
# conda
60-
ENV PATH="/home/devuser/conda/bin:$PATH"
61-
ENV PATH="/home/devuser/conda/envs/py312/bin:$PATH"
76+
ENV PATH="/opt/conda/bin:$PATH"
77+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
6278

6379
# Triton
6480
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"
6581

66-
# Install python packages
67-
COPY install/install_python_packages.sh /install/install_python_packages.sh
68-
RUN bash /install/install_python_packages.sh
69-
RUN echo "source activate py312" >> /home/devuser/.zshrc
70-
7182
# Set zsh as default shell
7283
ENV SHELL=/bin/zsh
7384
CMD [ "zsh" ]

docker/Dockerfile.cu129.dev

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FROM nvidia/cuda:12.9.0-devel-ubuntu24.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
# Update package lists and install system dependencies
6+
RUN apt-get update && apt-get install -y \
7+
curl \
8+
git \
9+
wget \
10+
clang-format \
11+
clangd-19 \
12+
vim \
13+
zsh \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Install python
17+
COPY install/install_python.sh /install/install_python.sh
18+
RUN bash /install/install_python.sh py312
19+
20+
# Set home directory
21+
WORKDIR /workspace
22+
23+
RUN echo "source activate py312" >> ~/.bashrc
24+
ENV PATH="/opt/conda/bin:$PATH"
25+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
26+
27+
# Install torch and other python packages
28+
COPY install/install_python_packages.sh /install/install_python_packages.sh
29+
RUN bash /install/install_python_packages.sh cu126 && pip3 install pre-commit
30+
31+
# Install mpi4py in the conda environment
32+
RUN conda install -n py312 -y mpi4py
33+
34+
# Install oh-my-zsh
35+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
36+
37+
# Install zsh-autosuggestions
38+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
39+
40+
# Configure zsh
41+
RUN sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="fino-time"/' ~/.zshrc && \
42+
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
43+
44+
# Create a non-root user
45+
ARG USERNAME=devuser
46+
ARG USER_UID=1003
47+
ARG USER_GID=$USER_UID
48+
49+
# Create the user
50+
RUN groupadd --gid $USER_GID $USERNAME \
51+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
52+
# [Optional] Add sudo support
53+
&& apt-get update \
54+
&& apt-get install -y sudo \
55+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
56+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
57+
&& rm -rf /var/lib/apt/lists/*
58+
59+
# Remove default 'ubuntu' user (UID 1000) to prevent devcontainer permission conflicts
60+
# Ref: https://github.com/rapidsai/devcontainers/pull/373
61+
RUN if grep ubuntu:x:1000:1000 /etc/passwd >/dev/null; then userdel -f -r ubuntu; fi
62+
63+
# Copy zsh configuration to the new user's home
64+
RUN cp -r /root/.oh-my-zsh /home/$USERNAME/.oh-my-zsh && \
65+
cp /root/.zshrc /home/$USERNAME/.zshrc && \
66+
chown -R $USERNAME:$USERNAME /home/$USERNAME/.oh-my-zsh && \
67+
chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
68+
69+
# Switch to non-root user
70+
USER $USERNAME
71+
WORKDIR /home/$USERNAME
72+
73+
# clangd
74+
ENV PATH="/usr/lib/llvm-19/bin:$PATH"
75+
# conda
76+
ENV PATH="/opt/conda/bin:$PATH"
77+
ENV PATH="/opt/conda/envs/py312/bin:$PATH"
78+
79+
# Triton
80+
ENV TRITON_PTXAS_PATH="/usr/local/cuda/bin/ptxas"
81+
82+
# Set zsh as default shell
83+
ENV SHELL=/bin/zsh
84+
CMD [ "zsh" ]

0 commit comments

Comments
 (0)