Skip to content

Commit 979c587

Browse files
key4nggithub-actions[bot]
authored andcommitted
Merge pull request #3 from moirai-internal/dev_container
Add dev container Dockerfile and devcontainer.json
1 parent 6d8d0a2 commit 979c587

File tree

2 files changed

+264
-0
lines changed

2 files changed

+264
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "vllm",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"remoteUser": "devuser",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
// Python development
11+
"ms-python.python",
12+
"charliermarsh.ruff",
13+
// Rust development
14+
"rust-lang.rust-analyzer",
15+
"tamasfe.even-better-toml"
16+
]
17+
}
18+
},
19+
"forwardPorts": [],
20+
"runArgs": [
21+
"--gpus",
22+
"all"
23+
],
24+
// The two lines below ensures that your local changes in the sglang
25+
// repo is automatically synced to the sglang pip package installed
26+
// in the dev docker container. You can remove / comment out these
27+
// two lines if you prefer to sync code changes manually.
28+
"workspaceMount": "source=${localWorkspaceFolder},target=/vllm-workspace/vllm,type=bind",
29+
"workspaceFolder": "/vllm-workspace/vllm"
30+
}

docker/Dockerfile.dev

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
# Extend from the base vllm image
2+
FROM vllm/vllm-openai:latest
3+
4+
# Override the base image's entrypoint with a shell
5+
ENTRYPOINT ["/bin/bash"]
6+
7+
# Install development tools and utilities
8+
RUN apt-get update && apt-get install -y \
9+
gdb \
10+
ninja-build \
11+
vim \
12+
tmux \
13+
htop \
14+
wget \
15+
curl \
16+
locales \
17+
lsof \
18+
git \
19+
git-lfs \
20+
zsh \
21+
tree \
22+
silversearcher-ag \
23+
cloc \
24+
unzip \
25+
pkg-config \
26+
libssl-dev \
27+
bear \
28+
ccache \
29+
&& apt install -y rdma-core infiniband-diags openssh-server perftest ibverbs-providers libibumad3 libibverbs1 libnl-3-200 libnl-route-3-200 librdmacm1 \
30+
&& rm -rf /var/lib/apt/lists/* \
31+
&& apt-get clean
32+
33+
RUN apt update -y \
34+
&& apt install -y --no-install-recommends gnupg \
35+
&& echo "deb http://developer.download.nvidia.com/devtools/repos/ubuntu2004/amd64 /" | tee /etc/apt/sources.list.d/nvidia-devtools.list \
36+
&& apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub \
37+
&& apt update -y \
38+
&& apt install nsight-systems-cli -y
39+
40+
# Set up locale
41+
RUN locale-gen en_US.UTF-8
42+
ENV LANG en_US.UTF-8
43+
ENV LANGUAGE en_US:en
44+
ENV LC_ALL en_US.UTF-8
45+
46+
# Install minimal Python packages
47+
RUN python3 -m pip install --no-cache-dir \
48+
pytest \
49+
black \
50+
isort \
51+
icdiff \
52+
scikit_build_core \
53+
uv \
54+
pre-commit
55+
56+
# Install diff-so-fancy
57+
RUN curl -LSso /usr/local/bin/diff-so-fancy https://github.com/so-fancy/diff-so-fancy/releases/download/v1.4.4/diff-so-fancy \
58+
&& chmod +x /usr/local/bin/diff-so-fancy
59+
60+
# Install clang-format
61+
RUN curl -LSso /usr/local/bin/clang-format https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-32d3ac78/clang-format-16_linux-amd64 \
62+
&& chmod +x /usr/local/bin/clang-format
63+
64+
# Install clangd
65+
RUN curl -L https://github.com/clangd/clangd/releases/download/18.1.3/clangd-linux-18.1.3.zip -o clangd.zip \
66+
&& unzip clangd.zip \
67+
&& cp -r clangd_18.1.3/bin/* /usr/local/bin/ \
68+
&& cp -r clangd_18.1.3/lib/* /usr/local/lib/ \
69+
&& rm -rf clangd_18.1.3 clangd.zip
70+
71+
# Install CMake
72+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.1/cmake-3.31.1-linux-x86_64.tar.gz \
73+
&& tar -xzf cmake-3.31.1-linux-x86_64.tar.gz \
74+
&& cp -r cmake-3.31.1-linux-x86_64/bin/* /usr/local/bin/ \
75+
&& cp -r cmake-3.31.1-linux-x86_64/share/* /usr/local/share/ \
76+
&& rm -rf cmake-3.31.1-linux-x86_64 cmake-3.31.1-linux-x86_64.tar.gz
77+
78+
# Add yank script
79+
RUN echo '#!/bin/bash' > /usr/local/bin/yank && \
80+
echo 'put() {' >> /usr/local/bin/yank && \
81+
echo ' esc=$1' >> /usr/local/bin/yank && \
82+
echo ' test -n "$TMUX" -o -z "${TERM##screen*}" && esc="\033Ptmux;\033$esc\033\\"' >> /usr/local/bin/yank && \
83+
echo ' printf "$esc"' >> /usr/local/bin/yank && \
84+
echo '}' >> /usr/local/bin/yank && \
85+
echo 'put "\033]52;c;!\a"' >> /usr/local/bin/yank && \
86+
echo 'buf=$( cat "$@" )' >> /usr/local/bin/yank && \
87+
echo 'len=$( printf %s "$buf" | wc -c ) max=74994' >> /usr/local/bin/yank && \
88+
echo 'test $len -gt $max && echo "$0: input is $(( len - max )) bytes too long" >&2' >> /usr/local/bin/yank && \
89+
echo 'put "\033]52;c;$( printf %s "$buf" | head -c $max | base64 | tr -d '\''\r\n'\'' )\a"' >> /usr/local/bin/yank && \
90+
echo 'test -n "$TMUX" && tmux set-buffer "$buf" ||:' >> /usr/local/bin/yank && \
91+
chmod +x /usr/local/bin/yank
92+
93+
# Install oh-my-zsh and plugins
94+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \
95+
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
96+
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
97+
98+
# Configure Vim
99+
RUN echo 'function! Yank(text) abort' > /root/.vimrc && \
100+
echo ' let escape = system("yank", a:text)' >> /root/.vimrc && \
101+
echo ' if v:shell_error' >> /root/.vimrc && \
102+
echo ' echoerr escape' >> /root/.vimrc && \
103+
echo ' else' >> /root/.vimrc && \
104+
echo ' call writefile([escape], "/dev/tty", "b")' >> /root/.vimrc && \
105+
echo ' endif' >> /root/.vimrc && \
106+
echo 'endfunction' >> /root/.vimrc && \
107+
echo '' >> /root/.vimrc && \
108+
echo 'noremap <silent> <Leader>y y:<C-U>call Yank(@0)<CR>' >> /root/.vimrc && \
109+
echo '' >> /root/.vimrc && \
110+
echo '" automatically run yank(1) whenever yanking in Vim' >> /root/.vimrc && \
111+
echo 'function! CopyYank() abort' >> /root/.vimrc && \
112+
echo ' call Yank(join(v:event.regcontents, "\n"))' >> /root/.vimrc && \
113+
echo 'endfunction' >> /root/.vimrc && \
114+
echo '' >> /root/.vimrc && \
115+
echo 'autocmd TextYankPost * call CopyYank()' >> /root/.vimrc && \
116+
echo '' >> /root/.vimrc && \
117+
echo '" Basic settings' >> /root/.vimrc && \
118+
echo 'set number' >> /root/.vimrc && \
119+
echo 'syntax on' >> /root/.vimrc && \
120+
echo 'set mouse=a' >> /root/.vimrc && \
121+
echo 'filetype indent on' >> /root/.vimrc && \
122+
echo '' >> /root/.vimrc && \
123+
echo '" Indentation' >> /root/.vimrc && \
124+
echo 'set autoindent nosmartindent' >> /root/.vimrc && \
125+
echo 'set smarttab' >> /root/.vimrc && \
126+
echo 'set expandtab' >> /root/.vimrc && \
127+
echo 'set shiftwidth=4' >> /root/.vimrc && \
128+
echo 'set softtabstop=4' >> /root/.vimrc && \
129+
echo '' >> /root/.vimrc && \
130+
echo '" Visual guides' >> /root/.vimrc && \
131+
echo 'set colorcolumn=120' >> /root/.vimrc && \
132+
echo 'highlight ColorColumn ctermbg=5' >> /root/.vimrc && \
133+
echo '' >> /root/.vimrc && \
134+
echo '" Status line' >> /root/.vimrc && \
135+
echo 'set laststatus=2' >> /root/.vimrc && \
136+
echo 'set statusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P' >> /root/.vimrc && \
137+
echo '' >> /root/.vimrc && \
138+
echo '" Backspace behavior' >> /root/.vimrc && \
139+
echo 'set backspace=2' >> /root/.vimrc && \
140+
echo '' >> /root/.vimrc && \
141+
echo '" Encoding' >> /root/.vimrc && \
142+
echo 'set encoding=utf-8' >> /root/.vimrc && \
143+
echo 'set fileencoding=utf-8' >> /root/.vimrc
144+
145+
# Configure tmux
146+
RUN echo '# Pane border styling' > /root/.tmux.conf && \
147+
echo 'set -g pane-border-style fg=#742727,bg=black' >> /root/.tmux.conf && \
148+
echo 'set -g pane-active-border-style fg=red,bg=black' >> /root/.tmux.conf && \
149+
echo '' >> /root/.tmux.conf && \
150+
echo '# Status bar styling' >> /root/.tmux.conf && \
151+
echo 'set -g status-style bg=#0C8A92,fg=black' >> /root/.tmux.conf && \
152+
echo '' >> /root/.tmux.conf && \
153+
echo '# Change prefix key to backtick' >> /root/.tmux.conf && \
154+
echo 'set-option -g prefix `' >> /root/.tmux.conf && \
155+
echo 'unbind C-b' >> /root/.tmux.conf && \
156+
echo 'bind-key ` send-prefix' >> /root/.tmux.conf && \
157+
echo '' >> /root/.tmux.conf && \
158+
echo '# Split panes using - and = with current path' >> /root/.tmux.conf && \
159+
echo 'unbind \"' >> /root/.tmux.conf && \
160+
echo 'bind - splitw -v -c \"#{pane_current_path}\"' >> /root/.tmux.conf && \
161+
echo 'unbind %' >> /root/.tmux.conf && \
162+
echo 'bind = splitw -h -c \"#{pane_current_path}\"' >> /root/.tmux.conf && \
163+
echo '' >> /root/.tmux.conf && \
164+
echo '# Vi mode settings' >> /root/.tmux.conf && \
165+
echo 'bind-key -T copy-mode-vi Y send-keys -X copy-pipe \"yank > #{pane_tty}\"' >> /root/.tmux.conf && \
166+
echo 'set-window-option -g mode-keys vi' >> /root/.tmux.conf && \
167+
echo '' >> /root/.tmux.conf && \
168+
echo '# Other settings' >> /root/.tmux.conf && \
169+
echo 'set-option -g escape-time 0' >> /root/.tmux.conf && \
170+
echo 'set-option -g base-index 1' >> /root/.tmux.conf && \
171+
echo 'set-window-option -g mouse on' >> /root/.tmux.conf
172+
173+
# Configure Git
174+
RUN git config --global core.editor "vim" \
175+
&& git config --global core.whitespace "fix,-indent-with-non-tab,trailing-space,cr-at-eol" \
176+
&& git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX" \
177+
&& git config --global color.ui true \
178+
&& git config --global color."diff-highlight".oldNormal "red bold" \
179+
&& git config --global color."diff-highlight".oldHighlight "red bold 52" \
180+
&& git config --global color."diff-highlight".newNormal "green bold" \
181+
&& git config --global color."diff-highlight".newHighlight "green bold 22" \
182+
&& git config --global color.diff.meta "11" \
183+
&& git config --global color.diff.frag "magenta bold" \
184+
&& git config --global color.diff.commit "yellow bold" \
185+
&& git config --global color.diff.old "red bold" \
186+
&& git config --global color.diff.new "green bold" \
187+
&& git config --global color.diff.whitespace "red reverse" \
188+
&& git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%C(auto)%d%Creset' --abbrev-commit --" \
189+
&& git config --global http.sslVerify false \
190+
&& git config --global pull.rebase true
191+
192+
# Configure zsh
193+
COPY --chown=root:root <<-"EOF" /root/.zshrc
194+
export ZSH="/root/.oh-my-zsh"
195+
196+
# Theme
197+
ZSH_THEME="robbyrussell"
198+
199+
# Plugins
200+
plugins=(
201+
git
202+
z
203+
zsh-autosuggestions
204+
zsh-syntax-highlighting
205+
)
206+
207+
source $ZSH/oh-my-zsh.sh
208+
209+
# Aliases
210+
alias ll='ls -alF'
211+
alias la='ls -A'
212+
alias l='ls -CF'
213+
alias vi='vim'
214+
215+
# Enhanced history
216+
HISTSIZE=10000
217+
SAVEHIST=10000
218+
setopt HIST_IGNORE_ALL_DUPS
219+
setopt HIST_FIND_NO_DUPS
220+
setopt INC_APPEND_HISTORY
221+
EOF
222+
223+
# Set workspace directory
224+
WORKDIR /vllm-workspace
225+
226+
RUN git clone --depth=1 https://github.com/vllm-project/vllm.git
227+
228+
# Create .devcontainer and .vscode directories
229+
RUN mkdir -p /vllm-workspace/vllm/.devcontainer /vllm-workspace/vllm/.vscode
230+
231+
# Copy .devcontainer and .vscode from host to container
232+
COPY .devcontainer /vllm-workspace/vllm/.devcontainer/
233+
234+
ENV PYTHONPATH=/vllm-workspace/vllm

0 commit comments

Comments
 (0)