From 23d3a915c8fe0c4d04d153b31a60b2b8a1e4a3c8 Mon Sep 17 00:00:00 2001 From: Lingxuan Zuo Date: Sun, 7 Apr 2024 00:00:42 +0800 Subject: [PATCH] [CI/CD]add docker dev builder (#64) * add docker dev builder * update read me * add arm64 bazel pkg install * show current os arch * assign aarch64 to arm64 * fix typo * install bazel script remove download resources * add build instruction * dash for title blank line --- README.rst | 14 +++++++++++++- docker/Dockerfile-dev | 10 ++++++++++ scripts/install-bazel.sh | 34 +++++++++++++++++++++++++++++----- 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 docker/Dockerfile-dev diff --git a/README.rst b/README.rst index 761160fb..67c256c2 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,13 @@ :target: docs/assets/infinite.svg :alt: mobius + +------------ + + Mobius : Online Machine Learning. ============ + `Mobius `_ is an AI infra platform including realtime computing and training. .. image:: https://github.com/ray-project/mobius/workflows/ubuntu-building/badge.svg @@ -12,7 +17,7 @@ Mobius : Online Machine Learning. .. image:: https://github.com/ray-project/mobius/workflows/macos-building/badge.svg :target: https://github.com/ray-project/mobius/actions/workflows/macos-building.yml -| + Ray Streaming ============= @@ -156,6 +161,13 @@ Key Features **Validation for continuous model delivery**. A validation mechanism to help our system keep delivering high-quality models and intercept all the abnormal models. +Build +---------------- + +Build from source code : +- Build a docker using docker/Dockerfile-env +- Execute `scripts/install.sh` + Getting Involved ---------------- diff --git a/docker/Dockerfile-dev b/docker/Dockerfile-dev new file mode 100644 index 00000000..c044ad88 --- /dev/null +++ b/docker/Dockerfile-dev @@ -0,0 +1,10 @@ +FROM ubuntu:22.04 +RUN apt-get update +RUN apt-get install -yq software-properties-common +RUN add-apt-repository -y ppa:deadsnakes/ppa +RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq wget gcc g++ openjdk-8-jdk maven python3.8 zlib1g-dev zip git pip +RUN git clone https://github.com/ray-project/mobius.git +RUN sh -c "bash mobius/scripts/install-bazel.sh" +RUN python3 -m pip install virtualenv +RUN python3 -m virtualenv -p python3 py3 +RUN pip install pytest "protobuf<4" \ No newline at end of file diff --git a/scripts/install-bazel.sh b/scripts/install-bazel.sh index b721148f..6d224496 100755 --- a/scripts/install-bazel.sh +++ b/scripts/install-bazel.sh @@ -1,6 +1,7 @@ #!/bin/bash # Current github bazel version is 5.0.0 platform="unknown" +arm=`uname -a | grep -o -m 1 -e "arm" -e "aarch64" | head -n 1` case "${OSTYPE}" in msys) @@ -22,13 +23,36 @@ case "${OSTYPE}" in ;; esac echo "platform is ${platform}" +echo "current arch is $arm" -if [ "${platform}" = "darwin" ]; then - wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-installer-darwin-x86_64.sh" -O bazel-5.4.1-installer-darwin-x86_64.sh - sh bazel-5.4.1-installer-darwin-x86_64.sh +if [ "${arm}" = "aarch64" ]; then + arm="arm64" +fi + +bazel_exe_file="" + +if [ "${platform}" = "darwin" ] && [ "${arm}" != "arm64" ]; then + bazel_exe_file="bazel-5.4.1-installer-darwin-x86_64.sh" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-installer-darwin-x86_64.sh" -O $bazel_exe_file + sh $bazel_exe_file +elif [ "${platform}" = "darwin" ] && [ "${arm}" = "arm64" ]; then + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-darwin-arm64" -O bazel-5.4.1-darwin-arm64 + chmod a+x bazel-5.4.1-darwin-arm64 + cp bazel-5.4.1-darwin-arm64 /usr/bin/bazel +elif [ "${platform}" = "linux" ] && [ "${arm}" = "arm64" ]; then + bazel_exe_file="bazel_5.4.1-linux-arm64" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-linux-arm64" -O $bazel_exe_file + chmod a+x $bazel_exe_file + cp $bazel_exe_file /usr/bin/bazel else - wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel_5.4.1-linux-x86_64.deb" -O bazel_5.4.1-linux-x86_64.deb - dpkg -i bazel_5.4.1-linux-x86_64.deb + bazel_exe_file="bazel_5.4.1-linux-x86_64.deb" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel_5.4.1-linux-x86_64.deb" -O $bazel_exe_file + dpkg -i $bazel_exe_file +fi + +if [ -e $bazel_exe_file ]; then + echo "Remove download file $bazel_exe_file" + rm $bazel_exe_file fi bazel --version