Unverified Commit db15148c authored by Chang Su's avatar Chang Su Committed by GitHub
Browse files

[router] update router docker to use maturin and build from local (#12350)

parent 5259becd
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment