"mmdet3d/structures/points/base_points.py" did not exist on "d3213cd3eb5cd64733844d80ca638ee1f0355bb1"
Dockerfile.router 2.48 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
######################## BASE IMAGE ##########################
FROM ubuntu:24.04 AS base

ARG PYTHON_VERSION=3.12

# set the environment variables
ENV PATH="/root/.local/bin:${PATH}"
ENV DEBIAN_FRONTEND=noninteractive

# uv environment variables
ENV UV_HTTP_TIMEOUT=500
ENV VIRTUAL_ENV="/opt/venv"
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
ENV UV_LINK_MODE="copy"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"


# install dependencies
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
    && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
    && apt update -y \
    && apt install -y curl \
    && rm -rf /var/lib/apt/lists/* \
    && apt clean

# install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

# install python
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}

32
33
34
FROM scratch AS local_src
COPY . /src

35
36
37
38
######################### BUILD IMAGE #########################
FROM base AS build-image

ARG SGLANG_REPO_REF=main
39
ARG BRANCH_TYPE=remote
40
41
42
43
44
45

# set the environment variables
ENV PATH="/root/.cargo/bin:${PATH}"

# install dependencies
RUN apt update -y \
46
    && apt install -y git build-essential libssl-dev pkg-config protobuf-compiler \
47
48
49
50
51
    && rm -rf /var/lib/apt/lists/* \
    && apt clean

# install rustup from rustup.rs
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
52
    && rustc --version && cargo --version && protoc --version
53

54
55
56
57
58
59
60
61
62
63
64
# 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
65
66
67
68
69

# working directory
WORKDIR /opt/sglang/sgl-router

# build the rust dependencies
70
71
72
RUN cargo clean \
    && rm -rf dist/ \
    && cargo build --release \
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
    && uv build \
    && rm -rf /root/.cache

######################### ROUTER IMAGE #########################
FROM base AS router-image

# Copy the built package from the build image
COPY --from=build-image /opt/sglang/sgl-router/dist/*.whl dist/

# Build the package and install
RUN uv pip install --force-reinstall dist/*.whl

# Clean up unnecessary files to reduce the image size
RUN rm -rf /root/.cache \
    && apt purge -y --auto-remove curl

# Set the entrypoint to the main command
ENTRYPOINT ["python3", "-m", "sglang_router.launch_router"]