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
db15148c
Unverified
Commit
db15148c
authored
Oct 29, 2025
by
Chang Su
Committed by
GitHub
Oct 29, 2025
Browse files
[router] update router docker to use maturin and build from local (#12350)
parent
5259becd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
docker/router.Dockerfile
docker/router.Dockerfile
+7
-19
No files found.
docker/router.Dockerfile
View file @
db15148c
...
@@ -35,9 +35,6 @@ COPY . /src
...
@@ -35,9 +35,6 @@ COPY . /src
######################### BUILD IMAGE #########################
######################### BUILD IMAGE #########################
FROM
base AS build-image
FROM
base AS build-image
ARG
SGLANG_REPO_REF=main
ARG
BRANCH_TYPE=remote
# set the environment variables
# set the environment variables
ENV
PATH="/root/.cargo/bin:${PATH}"
ENV
PATH="/root/.cargo/bin:${PATH}"
...
@@ -51,26 +48,17 @@ RUN apt update -y \
...
@@ -51,26 +48,17 @@ RUN apt update -y \
RUN
curl
--proto
'=https'
--tlsv1
.2
-sSf
https://sh.rustup.rs | sh
-s
--
-y
\
RUN
curl
--proto
'=https'
--tlsv1
.2
-sSf
https://sh.rustup.rs | sh
-s
--
-y
\
&&
rustc
--version
&&
cargo
--version
&&
protoc
--version
&&
rustc
--version
&&
cargo
--version
&&
protoc
--version
# pull the github repository or use local source
# copy source code
COPY
--from=local_src /src /tmp/local_src
COPY
--from=local_src /src /opt/sglang
RUN if
[
"
$BRANCH_TYPE
"
=
"local"
]
;
then
\
cp
-r
/tmp/local_src /opt/sglang
;
\
else
\
cd
/opt
\
&&
git clone
--depth
=
1 https://github.com/sgl-project/sglang.git
\
&&
cd
/opt/sglang
\
&&
git checkout
${
SGLANG_REPO_REF
}
;
\
fi
\
&&
rm
-rf
/tmp/local_src
# working directory
# working directory
WORKDIR
/opt/sglang/sgl-router
WORKDIR
/opt/sglang/sgl-router
# build the rust dependencies
# install maturin and build the wheel with vendored OpenSSL
RUN
cargo clean
\
RUN
uv pip
install
maturin
\
&&
cargo clean
\
&&
rm
-rf
dist/
\
&&
rm
-rf
dist/
\
&&
cargo build
--release
\
&&
maturin build
--release
--features
vendored-openssl
--out
dist
\
&&
uv build
\
&&
rm
-rf
/root/.cache
&&
rm
-rf
/root/.cache
######################### ROUTER IMAGE #########################
######################### ROUTER IMAGE #########################
...
@@ -83,7 +71,7 @@ COPY --from=build-image /opt/sglang/sgl-router/dist/*.whl dist/
...
@@ -83,7 +71,7 @@ COPY --from=build-image /opt/sglang/sgl-router/dist/*.whl dist/
RUN
uv pip
install
--force-reinstall
dist/
*
.whl
RUN
uv pip
install
--force-reinstall
dist/
*
.whl
# Clean up unnecessary files to reduce the image size
# Clean up unnecessary files to reduce the image size
RUN
rm
-rf
/root/.cache
\
RUN
rm
-rf
/root/.cache
dist/
\
&&
apt purge
-y
--auto-remove
curl
&&
apt purge
-y
--auto-remove
curl
# Set the entrypoint to the main command
# Set the entrypoint to the main command
...
...
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