Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
4a893d14
Unverified
Commit
4a893d14
authored
Mar 08, 2025
by
Kebe
Committed by
GitHub
Mar 08, 2025
Browse files
Refactor Dockerfile: unify CUDA logic and reduce image size by ~2.6 GB (#3749)
Signed-off-by:
Kebe
<
mail@kebe7jun.com
>
parent
8d323e95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
32 deletions
+7
-32
docker/Dockerfile
docker/Dockerfile
+7
-32
No files found.
docker/Dockerfile
View file @
4a893d14
...
@@ -30,44 +30,19 @@ ARG CUDA_VERSION
...
@@ -30,44 +30,19 @@ ARG CUDA_VERSION
RUN
python3
-m
pip
install
--upgrade
pip setuptools wheel html5lib six
\
RUN
python3
-m
pip
install
--upgrade
pip setuptools wheel html5lib six
\
&&
git clone
--depth
=
1 https://github.com/sgl-project/sglang.git
\
&&
git clone
--depth
=
1 https://github.com/sgl-project/sglang.git
\
&&
if
[
"
$CUDA_VERSION
"
=
"12.1.1"
]
;
then
\
&&
if
[
"
$CUDA_VERSION
"
=
"12.1.1"
]
;
then
\
python3
-m
pip
install
torch
--index-url
https://download.pytorch.org/whl/cu
121
;
\
export
CUINDEX
=
121
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.4.1"
]
;
then
\
elif
[
"
$CUDA_VERSION
"
=
"12.4.1"
]
;
then
\
python3
-m
pip
install
torch
--index-url
https://download.pytorch.org/whl/cu
124
;
\
export
CUINDEX
=
124
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.5.1"
]
;
then
\
elif
[
"
$CUDA_VERSION
"
=
"12.5.1"
]
;
then
\
python3
-m
pip
install
torch
--index-url
https://download.pytorch.org/whl/cu
124
;
\
export
CUINDEX
=
124
;
\
elif
[
"
$CUDA_VERSION
"
=
"11.8.0"
]
;
then
\
elif
[
"
$CUDA_VERSION
"
=
"11.8.0"
]
;
then
\
python3
-m
pip
install
torch
--index-url
https://download.pytorch.org/whl/cu
118
;
\
export
CUINDEX
=
118
;
\
python3
-m
pip
install
sgl-kernel
-i
https://docs.sglang.ai/whl/cu118
;
\
python3
-m
pip
install
--no-cache-dir
sgl-kernel
-i
https://docs.sglang.ai/whl/cu118
;
\
else
\
else
\
echo
"Unsupported CUDA version:
$CUDA_VERSION
"
&&
exit
1
;
\
echo
"Unsupported CUDA version:
$CUDA_VERSION
"
&&
exit
1
;
\
fi
\
fi
\
&&
python3
-m
pip
install
--no-cache-dir
torch
--index-url
https://download.pytorch.org/whl/cu
${
CUINDEX
}
\
&&
cd
sglang
\
&&
cd
sglang
\
&&
if
[
"
$BUILD_TYPE
"
=
"srt"
]
;
then
\
&&
python3
-m
pip
--no-cache-dir
install
-e
"python[
${
BUILD_TYPE
}
]"
--find-links
https://flashinfer.ai/whl/cu
${
CUINDEX
}
/torch2.5/flashinfer-python
if
[
"
$CUDA_VERSION
"
=
"12.1.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[srt]"
--find-links
https://flashinfer.ai/whl/cu121/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.4.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[srt]"
--find-links
https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.5.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[srt]"
--find-links
https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"11.8.0"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[srt]"
--find-links
https://flashinfer.ai/whl/cu118/torch2.5/flashinfer-python
;
\
python3
-m
pip
install
sgl-kernel
-i
https://docs.sglang.ai/whl/cu118
;
\
else
\
echo
"Unsupported CUDA version:
$CUDA_VERSION
"
&&
exit
1
;
\
fi
;
\
else
\
if
[
"
$CUDA_VERSION
"
=
"12.1.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[all]"
--find-links
https://flashinfer.ai/whl/cu121/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.4.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[all]"
--find-links
https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"12.5.1"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[all]"
--find-links
https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python
;
\
elif
[
"
$CUDA_VERSION
"
=
"11.8.0"
]
;
then
\
python3
-m
pip
--no-cache-dir
install
-e
"python[all]"
--find-links
https://flashinfer.ai/whl/cu118/torch2.5/flashinfer-python
;
\
python3
-m
pip
install
sgl-kernel
-i
https://docs.sglang.ai/whl/cu118
;
\
else
\
echo
"Unsupported CUDA version:
$CUDA_VERSION
"
&&
exit
1
;
\
fi
;
\
fi
ENV
DEBIAN_FRONTEND=interactive
ENV
DEBIAN_FRONTEND=interactive
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment