-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] added base docker image for python wheel build (#182)
- Loading branch information
Showing
11 changed files
with
261 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Publish docker base image | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish_base: | ||
runs-on: [self-hosted, linux, build] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USER }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
|
||
- name: Build base for cuda 12.1 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./docker | ||
file: ./docker/Dockerfile.base | ||
push: true | ||
build-args: | | ||
UBUNTU_VERSION=22.04 | ||
CUDA_VERSION=12.1 | ||
GCC_VERSION=12 | ||
CMAKE_VERSION=3.18.5 | ||
NINJA_VERSION=1.9.0 | ||
tags: | | ||
vectorchai/scalellm_builder:cuda12.1-ubuntu22.04 | ||
- name: Build base for cuda 11.8 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./docker | ||
file: ./docker/Dockerfile.base | ||
push: true | ||
build-args: | | ||
UBUNTU_VERSION=22.04 | ||
CUDA_VERSION=11.8 | ||
GCC_VERSION=12 | ||
CMAKE_VERSION=3.18.5 | ||
NINJA_VERSION=1.9.0 | ||
tags: | | ||
vectorchai/scalellm_builder:cuda11.8-ubuntu22.04 | ||
2 changes: 1 addition & 1 deletion
2
.github/workflows/docker.yml → .github/workflows/release_cpp.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Install common dependencies | ||
COPY ./common/install_base.sh install_base.sh | ||
RUN bash ./install_base.sh && rm install_base.sh | ||
|
||
# Install multiple python versions | ||
COPY ./common/install_python.sh install_python.sh | ||
RUN bash ./install_python.sh "3.9.0" | ||
RUN bash ./install_python.sh "3.10.1" | ||
RUN bash ./install_python.sh "3.11.0" | ||
RUN bash ./install_python.sh "3.12.0" | ||
RUN rm install_python.sh | ||
|
||
# Install cuda, cudnn and nccl | ||
ARG CUDA_VERSION=12.1 | ||
RUN wget -q https://raw.githubusercontent.com/pytorch/builder/main/common/install_cuda.sh -O install_cuda.sh | ||
RUN bash ./install_cuda.sh ${CUDA_VERSION} && rm install_cuda.sh | ||
ENV DESIRED_CUDA ${CUDA_VERSION} | ||
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH | ||
|
||
# Install gcc | ||
ARG GCC_VERSION=12 | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
software-properties-common gpg-agent | ||
COPY ./common/install_gcc.sh install_gcc.sh | ||
RUN bash ./install_gcc.sh && rm install_gcc.sh | ||
|
||
ARG CMAKE_VERSION=3.18.5 | ||
COPY ./common/install_cmake.sh install_cmake.sh | ||
RUN if [ -n "${CMAKE_VERSION}" ]; then bash ./install_cmake.sh; fi | ||
RUN rm install_cmake.sh | ||
|
||
ARG NINJA_VERSION=1.9.0 | ||
COPY ./common/install_ninja.sh install_ninja.sh | ||
RUN if [ -n "${NINJA_VERSION}" ]; then bash ./install_ninja.sh; fi | ||
RUN rm install_ninja.sh | ||
|
||
# install rust | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
ENV PATH=$HOME/.cargo/bin:$PATH | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
install_ubuntu() { | ||
deploy_deps="libffi-dev libbz2-dev libreadline-dev libncurses5-dev libncursesw5-dev libgdbm-dev libsqlite3-dev uuid-dev tk-dev" | ||
# Install common dependencies | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
${deploy_deps} \ | ||
build-essential \ | ||
ccache \ | ||
zip \ | ||
pkg-config \ | ||
libssl-dev \ | ||
libboost-all-dev \ | ||
software-properties-common \ | ||
curl \ | ||
git \ | ||
wget \ | ||
sudo \ | ||
vim \ | ||
jq \ | ||
libtool \ | ||
unzip \ | ||
gdb | ||
|
||
# Cleanup package manager | ||
apt-get autoclean && apt-get clean | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
} | ||
|
||
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') | ||
case "$ID" in | ||
ubuntu) | ||
install_ubuntu | ||
;; | ||
*) | ||
echo "Unable to determine OS..." | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
[ -n "$CMAKE_VERSION" ] | ||
|
||
# Remove system cmake install so it won't get used instead | ||
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') | ||
case "$ID" in | ||
ubuntu) | ||
apt-get remove cmake -y | ||
;; | ||
*) | ||
echo "Unable to determine OS..." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Turn 3.6.3 into v3.6 | ||
path=$(echo "${CMAKE_VERSION}" | sed -e 's/\([0-9].[0-9]\+\).*/v\1/') | ||
file="cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" | ||
|
||
# Download and install specific CMake version in /usr/local | ||
pushd /tmp | ||
curl -Os --retry 3 "https://cmake.org/files/${path}/${file}" | ||
tar -C /usr/local --strip-components 1 --no-same-owner -zxf cmake-*.tar.gz | ||
rm -f cmake-*.tar.gz | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
[ -n "$GCC_VERSION" ] | ||
|
||
install_ubuntu() { | ||
# Need the official toolchain repo to get alternate packages | ||
add-apt-repository ppa:ubuntu-toolchain-r/test | ||
apt-get update | ||
apt-get install -y g++-$GCC_VERSION | ||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-"$GCC_VERSION" 50 | ||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-"$GCC_VERSION" 50 | ||
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-"$GCC_VERSION" 50 | ||
|
||
|
||
# Cleanup package manager | ||
apt-get autoclean && apt-get clean | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
} | ||
|
||
|
||
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') | ||
case "$ID" in | ||
ubuntu) | ||
install_ubuntu | ||
;; | ||
*) | ||
echo "Unable to determine OS..." | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
[ -n "$NINJA_VERSION" ] | ||
|
||
url="https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" | ||
|
||
pushd /tmp | ||
wget --no-verbose --output-document=ninja-linux.zip "$url" | ||
unzip ninja-linux.zip -d /usr/local/bin | ||
rm -f ninja-linux.zip | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
PYTHON_VERSION="$1" | ||
shift | ||
|
||
NO_RC_PYTHON_VERSION="${PYTHON_VERSION%rc*}" | ||
|
||
url="https://www.python.org/ftp/python/${NO_RC_PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" | ||
|
||
pushd /tmp | ||
wget "$url" | ||
tar xvzf "Python-${PYTHON_VERSION}.tgz" | ||
cd "Python-${PYTHON_VERSION}" | ||
|
||
# Extract major and minor version number | ||
MAJOR=$(echo "${PYTHON_VERSION}" | cut -d . -f 1) | ||
MINOR=$(echo "${PYTHON_VERSION}" | cut -d . -f 2) | ||
|
||
INSTALL_FOLDER="/opt/python/cp${MAJOR}${MINOR}-cp${MAJOR}${MINOR}" | ||
|
||
./configure \ | ||
--enable-shared \ | ||
--enable-ipv6 \ | ||
--prefix=${INSTALL_FOLDER} \ | ||
LDFLAGS=-Wl,-rpath=${INSTALL_FOLDER}/lib,--disable-new-dtags | ||
|
||
make -j$(nproc) install | ||
# upgrade pip, setuptools and wheel | ||
${INSTALL_FOLDER}/bin/python3 -m pip install --upgrade pip setuptools wheel | ||
# create symlinks | ||
cp ${INSTALL_FOLDER}/bin/pip3 ${INSTALL_FOLDER}/bin/pip | ||
ln -s ${INSTALL_FOLDER}/bin/python3 ${INSTALL_FOLDER}/bin/python | ||
|
||
rm -rf "Python-${PYTHON_VERSION}" | ||
popd | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters