Unverified Commit 6dc9ca8c authored by Arthur Cheng's avatar Arthur Cheng Committed by GitHub
Browse files

[router] Add BRANCH_TYPE=local support to Dockerfile.router for local builds (#11571)

parent 887c2b45
......@@ -29,10 +29,14 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# install python
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
FROM scratch AS local_src
COPY . /src
######################### BUILD IMAGE #########################
FROM base AS build-image
ARG SGLANG_REPO_REF=main
ARG BRANCH_TYPE=remote
# set the environment variables
ENV PATH="/root/.cargo/bin:${PATH}"
......@@ -47,17 +51,25 @@ RUN apt update -y \
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& rustc --version && cargo --version && protoc --version
# pull the github repository
RUN cd /opt \
&& git clone --depth=1 https://github.com/sgl-project/sglang.git \
&& cd /opt/sglang \
&& git checkout ${SGLANG_REPO_REF}
# pull the github repository or use local source
COPY --from=local_src /src /tmp/local_src
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
WORKDIR /opt/sglang/sgl-router
# build the rust dependencies
RUN cargo build --release \
RUN cargo clean \
&& rm -rf dist/ \
&& cargo build --release \
&& uv build \
&& rm -rf /root/.cache
......
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