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 ...@@ -29,10 +29,14 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# install python # install python
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV} RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
FROM scratch AS local_src
COPY . /src
######################### BUILD IMAGE ######################### ######################### BUILD IMAGE #########################
FROM base AS build-image FROM base AS build-image
ARG SGLANG_REPO_REF=main 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}"
...@@ -47,17 +51,25 @@ RUN apt update -y \ ...@@ -47,17 +51,25 @@ 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 # pull the github repository or use local source
RUN cd /opt \ COPY --from=local_src /src /tmp/local_src
&& git clone --depth=1 https://github.com/sgl-project/sglang.git \ RUN if [ "$BRANCH_TYPE" = "local" ]; then \
&& cd /opt/sglang \ cp -r /tmp/local_src /opt/sglang; \
&& git checkout ${SGLANG_REPO_REF} 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 # build the rust dependencies
RUN cargo build --release \ RUN cargo clean \
&& rm -rf dist/ \
&& cargo build --release \
&& uv build \ && uv build \
&& rm -rf /root/.cache && 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