Dockerfile for CentOS CI build (#1986)

This commit is contained in:
Changming Sun 2019-10-03 11:46:27 -07:00 committed by GitHub
parent a1f8fe1463
commit c86d17754a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 79 additions and 48 deletions

View file

@ -0,0 +1,12 @@
ARG OS_VERSION=7
FROM centos:${OS_VERSION}
ARG PYTHON_VERSION
ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts
ARG BUILD_UID=1000
ARG BUILD_USER=onnxruntimedev
RUN adduser --uid $BUILD_UID $BUILD_USER
WORKDIR /home/$BUILD_USER
USER $BUILD_USER

View file

@ -1,5 +1,6 @@
ARG OS_VERSION=27
ARG PYTHON_VERSION=3.6
FROM fedora:${OS_VERSION}
ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_fedora.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_fedora.sh && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts

View file

@ -6,5 +6,5 @@ ENV NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_REQUIRE_CUDA="cuda>=9.2" \
PATH="/usr/lib64/ccache:${PATH}"
ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_fedora_gpu.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_fedora_gpu.sh && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts

View file

@ -2,13 +2,10 @@ FROM quay.io/pypa/manylinux2010_x86_64:latest
ARG PYTHON_VERSION=3.5
ADD scripts/install_manylinux2010.sh /tmp/scripts/install_manylinux2010.sh
RUN /tmp/scripts/install_manylinux2010.sh -p ${PYTHON_VERSION}
ADD scripts/install_protobuf.sh /tmp/scripts/install_protobuf.sh
RUN (source /opt/onnxruntime-python/bin/activate; pip install cmake && /tmp/scripts/install_protobuf.sh && pip uninstall -y cmake)
ADD scripts /tmp/scripts
RUN (source /opt/onnxruntime-python/bin/activate; /tmp/scripts/install_deps.sh)
RUN rm -rf /tmp/scripts # not useful at all except not to see the scripts
RUN /tmp/scripts/install_manylinux2010.sh -p $PYTHON_VERSION && \
(source /opt/onnxruntime-python/bin/activate; /tmp/scripts/install_deps.sh -p $PYTHON_VERSION) && \
rm -rf /tmp/scripts # not useful at all except not to see the scripts
RUN echo "#!/bin/bash" > /opt/entrypoint.sh && \
echo "set -e" >> /opt/entrypoint.sh && \

View file

@ -2,13 +2,10 @@ FROM quay.io/pypa/manylinux2010_x86_64:latest
ARG PYTHON_VERSION=3.5
ADD scripts/install_manylinux2010.sh /tmp/scripts/install_manylinux2010.sh
RUN /tmp/scripts/install_manylinux2010.sh -p ${PYTHON_VERSION}
ADD scripts/install_protobuf.sh /tmp/scripts/install_protobuf.sh
RUN (source /opt/onnxruntime-python/bin/activate; pip install cmake && /tmp/scripts/install_protobuf.sh && pip uninstall -y cmake)
ADD scripts /tmp/scripts
RUN (source /opt/onnxruntime-python/bin/activate; /tmp/scripts/install_deps.sh)
RUN rm -rf /tmp/scripts # not useful at all except not to see the scripts
RUN /tmp/scripts/install_manylinux2010.sh -p $PYTHON_VERSION && \
(source /opt/onnxruntime-python/bin/activate; /tmp/scripts/install_deps.sh -p $PYTHON_VERSION) && \
rm -rf /tmp/scripts # not useful at all except not to see the scripts
RUN echo "#!/bin/bash" > /opt/entrypoint.sh && \
echo "set -e" >> /opt/entrypoint.sh && \

View file

@ -4,7 +4,7 @@ FROM ubuntu:${OS_VERSION}
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts
WORKDIR /root

View file

@ -3,7 +3,7 @@ FROM ubuntu:${OS_VERSION}
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps_android.sh && /tmp/scripts/install_protobuf.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps_android.sh && /tmp/scripts/install_protobuf.sh && rm -rf /tmp/scripts
WORKDIR /root

View file

@ -7,7 +7,7 @@ FROM nvidia/cuda@sha256:362e4e25aa46a18dfa834360140e91b61cdb0a3a2796c8e09dadb268
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts
WORKDIR /root

View file

@ -8,7 +8,7 @@ ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
ENV PATH="/opt/cmake/bin:${PATH}"
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts
WORKDIR /root

View file

@ -6,8 +6,8 @@ ARG OPENVINO_VERSION=2019_R1.1
ADD scripts /tmp/scripts
ENV PATH="/opt/cmake/bin:${PATH}"
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} -d EdgeDevice && \
/tmp/scripts/install_deps.sh
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION -d EdgeDevice && \
/tmp/scripts/install_deps.sh -p $PYTHON_VERSION
RUN apt update && apt install -y libnuma1 ocl-icd-libopencl1 && \
rm -rf /var/lib/apt/lists/*

View file

@ -4,7 +4,7 @@ FROM ubuntu:${OS_VERSION}
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && /tmp/scripts/install_server_deps.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && /tmp/scripts/install_server_deps.sh && rm -rf /tmp/scripts
WORKDIR /root

View file

@ -7,7 +7,7 @@ FROM nvcr.io/nvidia/tensorrt:19.06-py3
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts \
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts \
&& rm /usr/local/bin/cmake && rm /usr/local/bin/ctest && rm -r /usr/local/share/cmake-3.12
WORKDIR /root

View file

@ -4,7 +4,7 @@ FROM i386/ubuntu:${OS_VERSION}
ARG PYTHON_VERSION=3.5
ADD scripts /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN /tmp/scripts/install_ubuntu.sh -p $PYTHON_VERSION && /tmp/scripts/install_deps.sh -p $PYTHON_VERSION && rm -rf /tmp/scripts
WORKDIR /root
ENV LD_LIBRARY_PATH /usr/local/openblas/lib:$LD_LIBRARY_PATH

View file

@ -1,12 +1,7 @@
#!/bin/bash
set -e
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm https://centos7.iuscommunity.org/ius-release.rpm
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum remove --tolerant cmake git
yum install -y cmake3 git2u-all
ln -s /usr/bin/cmake3 /usr/bin/cmake
ln -s /usr/bin/ctest3 /usr/bin/ctest
yum install -y redhat-lsb-core expat-devel libcurl-devel protobuf-compiler protobuf-devel protobuf rpmdevtools tar unzip ccache curl gcc gcc-c++ zlib-devel make python2-devel python3-devel python3-numpy libunwind icu aria2 rsync python3-setuptools python3-wheel bzip2
yum install -y redhat-lsb-core expat-devel libcurl-devel rpmdevtools tar unzip ccache curl gcc gcc-c++ zlib-devel make python2-devel python3-devel python3-pip python3-numpy libunwind icu aria2 rsync python3-setuptools python3-wheel bzip2 git

View file

@ -1,23 +1,53 @@
#!/bin/bash
set -e
SYS_LONG_BIT=$(getconf LONG_BIT)
while getopts p:d: parameter_Option
do case "${parameter_Option}"
in
p) PYTHON_VER=${OPTARG};;
d) DEVICE_TYPE=${OPTARG};;
esac
done
echo "Installing azcopy"
echo "Python version=$PYTHON_VER"
DEVICE_TYPE=${DEVICE_TYPE:=Normal}
SYS_LONG_BIT=$(getconf LONG_BIT)
mkdir -p /tmp/src
if [ $SYS_LONG_BIT = "64" ]; then
echo "Installing azcopy"
mkdir -p /tmp/azcopy
aria2c -q -d /tmp/azcopy -o azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux
tar --strip 1 -xf /tmp/azcopy/azcopy.tar.gz -C /tmp/azcopy
cp /tmp/azcopy/azcopy /usr/bin
echo "Installing cmake"
aria2c -q -d /tmp/src "https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz"
tar -zxf /tmp/src/cmake-3.15.4-Linux-x86_64.tar.gz --strip=1 -C /usr
else
echo "Installing cmake"
aria2c -q -d /tmp/src https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4.tar.gz
tar -xf /tmp/src/cmake-3.15.4.tar.gz -C /tmp/src
cd /tmp/src/cmake-3.15.4
./configure --prefix=/usr --parallel=`nproc` --system-curl --system-zlib --system-expat
make -j`nproc`
make install
fi
mkdir -p /tmp/src
aria2c -q -d /tmp/src https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz
tar -xf /tmp/src/cmake-3.13.2.tar.gz -C /tmp/src
cd /tmp/src/cmake-3.13.2
./configure --prefix=/usr --parallel=`nproc` --system-curl --system-zlib --system-expat
make -j`nproc`
make install
DISTRIBUTOR=$(lsb_release -i -s)
if ! [ -x "$(command -v protoc)" ]; then
source ${0/%install_deps\.sh/install_protobuf\.sh}
fi
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall numpy==1.15.0
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall requests==2.21.0
if [ $DEVICE_TYPE = "Normal" ]; then
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall sympy==1.1.1
fi
/usr/bin/python${PYTHON_VER} -m pip install --upgrade scipy
#install onnx
export ONNX_ML=1
@ -27,18 +57,19 @@ if [ "$INSTALLED_PYTHON_VERSION" = "3.7" ];then
fi
if [ "$INSTALLED_PYTHON_VERSION" = "3.4" ];then
echo "Python 3.5 and above is needed for running onnx tests!" 1>&2
else
else
source ${0/%install_deps\.sh/install_onnx\.sh} $INSTALLED_PYTHON_VERSION
fi
#The last onnx version will be kept
cd /
rm -rf /tmp/src
DISTRIBUTOR=$(lsb_release -i -s)
if [ "$DISTRIBUTOR" = "Ubuntu" ]; then
apt-get -y remove libprotobuf-dev protobuf-compiler
elif [ "$DISTRIBUTOR" = "CentOS" ]; then
yum -y remove libprotobuf-dev protobuf-compiler
rm -rf /usr/include/google
rm -rf /usr/lib64/libproto*
elif [ "$AUDITWHEEL_PLAT" = "manylinux2010_x86_64" ]; then
# we did not install protobuf 2.x no need to uninstall
:

View file

@ -80,12 +80,6 @@ if [ $PYTHON_VER != "3.5" ]; then
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall pip==19.0.3
fi
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall numpy==1.15.0
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall requests==2.21.0
if [ $DEVICE_TYPE = "Normal" ]; then
/usr/bin/python${PYTHON_VER} -m pip install --upgrade --force-reinstall sympy==1.1.1
fi
/usr/bin/python${PYTHON_VER} -m pip install --upgrade scipy
rm -rf /var/lib/apt/lists/*
if [ $DEVICE_TYPE = "Normal" ]; then

View file

@ -44,6 +44,10 @@ elif [ $BUILD_OS = "manylinux2010" ]; then
DOCKER_FILE=Dockerfile.manylinux2010
fi
docker build -t "onnxruntime-$IMAGE" --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=${PYTHON_VER} -f $DOCKER_FILE .
elif [ $BUILD_OS = "centos7" ]; then
IMAGE="centos7"
DOCKER_FILE=Dockerfile.centos
docker build -t "onnxruntime-$IMAGE" --build-arg OS_VERSION=7 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=${PYTHON_VER} -f $DOCKER_FILE .
else
if [ $BUILD_DEVICE = "gpu" ]; then
IMAGE="ubuntu16.04-$CUDA_VER"