feat: update Dockerfile (#1033)
Co-authored-by: vhain <vhain6512@gmail.com>
This commit is contained in:
26
.github/workflows/release-docker.yml
vendored
26
.github/workflows/release-docker.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Release Docker
|
name: Release Docker Images
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -14,7 +14,8 @@ jobs:
|
|||||||
environment: 'prod'
|
environment: 'prod'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
cuda_version: ['12.1.1', '12.4.1']
|
cuda_version: ['11.8.0', '12.1.1', '12.4.1']
|
||||||
|
build_type: ['all', 'srt']
|
||||||
steps:
|
steps:
|
||||||
- name: Delete huge unnecessary tools folder
|
- name: Delete huge unnecessary tools folder
|
||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
@@ -32,7 +33,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
version=$(cat python/sglang/version.py | cut -d'"' -f2)
|
version=$(cat python/sglang/version.py | cut -d'"' -f2)
|
||||||
|
|
||||||
if [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then
|
if [ "${{ matrix.cuda_version }}" = "11.8.0" ]; then
|
||||||
|
cuda_tag="cu118"
|
||||||
|
elif [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then
|
||||||
cuda_tag="cu121"
|
cuda_tag="cu121"
|
||||||
elif [ "${{ matrix.cuda_version }}" = "12.4.1" ]; then
|
elif [ "${{ matrix.cuda_version }}" = "12.4.1" ]; then
|
||||||
cuda_tag="cu124"
|
cuda_tag="cu124"
|
||||||
@@ -43,10 +46,19 @@ jobs:
|
|||||||
|
|
||||||
tag=v${version}-${cuda_tag}
|
tag=v${version}-${cuda_tag}
|
||||||
|
|
||||||
docker build . -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.cuda_version }} -t lmsysorg/sglang:${tag} --no-cache
|
if [ "${{ matrix.build_type }}" = "all" ]; then
|
||||||
docker push lmsysorg/sglang:${tag}
|
tag_suffix=""
|
||||||
|
elif [ "${{ matrix.build_type }}" = "srt" ]; then
|
||||||
|
tag_suffix="-srt"
|
||||||
|
else
|
||||||
|
echo "Unsupported build type"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build . -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.cuda_version }} --build-arg BUILD_TYPE=${{ matrix.build_type }} -t lmsysorg/sglang:${tag}${tag_suffix} --no-cache
|
||||||
|
docker push lmsysorg/sglang:${tag}${tag_suffix}
|
||||||
|
|
||||||
if [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then
|
if [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then
|
||||||
docker tag lmsysorg/sglang:${tag} lmsysorg/sglang:latest
|
docker tag lmsysorg/sglang:${tag}${tag_suffix} lmsysorg/sglang:latest${tag_suffix}
|
||||||
docker push lmsysorg/sglang:latest
|
docker push lmsysorg/sglang:latest${tag_suffix}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,34 +1,49 @@
|
|||||||
ARG CUDA_VERSION=12.1.1
|
ARG CUDA_VERSION=12.1.1
|
||||||
|
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu20.04
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
|
ARG BUILD_TYPE=all
|
||||||
|
|
||||||
ARG PYTHON_VERSION=3
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
|
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
|
||||||
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
|
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
|
||||||
&& apt-get update -y \
|
&& apt update -y \
|
||||||
&& apt-get install -y ccache software-properties-common \
|
&& apt install software-properties-common -y \
|
||||||
&& add-apt-repository ppa:deadsnakes/ppa \
|
&& add-apt-repository ppa:deadsnakes/ppa -y && apt update \
|
||||||
&& apt-get update -y \
|
&& apt install python3.10 -y \
|
||||||
&& apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv python${PYTHON_VERSION}-pip \
|
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 \
|
||||||
&& if [ "${PYTHON_VERSION}" != "3" ]; then update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1; fi \
|
&& update-alternatives --set python3 /usr/bin/python3.10 && apt install python3.10-distutils -y \
|
||||||
|
&& apt install curl git sudo -y \
|
||||||
|
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py \
|
||||||
&& python3 --version \
|
&& python3 --version \
|
||||||
&& python3 -m pip --version \
|
&& python3 -m pip --version \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& apt-get clean
|
&& apt clean
|
||||||
|
|
||||||
RUN apt-get update -y \
|
|
||||||
&& apt-get install -y git curl sudo
|
|
||||||
|
|
||||||
WORKDIR /sgl-workspace
|
WORKDIR /sgl-workspace
|
||||||
|
|
||||||
RUN pip3 --no-cache-dir install --upgrade pip \
|
RUN python3 -m pip install --upgrade pip setuptools wheel html5lib six \
|
||||||
&& pip3 --no-cache-dir install --upgrade setuptools wheel \
|
|
||||||
&& git clone --depth=1 https://github.com/sgl-project/sglang.git \
|
&& git clone --depth=1 https://github.com/sgl-project/sglang.git \
|
||||||
&& cd sglang \
|
&& cd sglang \
|
||||||
&& pip --no-cache-dir install -e "python[all]" \
|
&& if [ "$BUILD_TYPE" = "srt" ]; then \
|
||||||
&& pip3 --no-cache-dir install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.4/
|
python3 -m pip --no-cache-dir install -e "python[srt]"; \
|
||||||
|
else \
|
||||||
|
python3 -m pip --no-cache-dir install -e "python[all]"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
ARG CUDA_VERSION
|
||||||
|
RUN if [ "$CUDA_VERSION" = "12.1.1" ]; then \
|
||||||
|
export CUDA_IDENTIFIER=cu121 && \
|
||||||
|
python3 -m pip --no-cache-dir install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.4/; \
|
||||||
|
elif [ "$CUDA_VERSION" = "12.4.1" ]; then \
|
||||||
|
export CUDA_IDENTIFIER=cu124 && \
|
||||||
|
python3 -m pip --no-cache-dir install flashinfer -i https://flashinfer.ai/whl/cu124/torch2.4/; \
|
||||||
|
elif [ "$CUDA_VERSION" = "11.8.0" ]; then \
|
||||||
|
export CUDA_IDENTIFIER=cu118 && \
|
||||||
|
python3 -m pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu118 && \
|
||||||
|
python3 -m pip --no-cache-dir install flashinfer -i https://flashinfer.ai/whl/cu118/torch2.4/; \
|
||||||
|
else \
|
||||||
|
echo "Unsupported CUDA version: $CUDA_VERSION" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN python3 -m pip cache purge
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=interactive
|
ENV DEBIAN_FRONTEND=interactive
|
||||||
|
|||||||
Reference in New Issue
Block a user