|
| 1 | +ARG CUDA_VERSION_ARG |
| 2 | +FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-centos6 |
| 3 | +ARG CUDA_VERSION_ARG |
| 4 | + |
| 5 | +# Environment |
| 6 | +ENV DEBIAN_FRONTEND noninteractive |
| 7 | +ENV DEVTOOLSET_URL_ROOT http://vault.centos.org/6.9/sclo/x86_64/rh/devtoolset-4/ |
| 8 | + |
| 9 | +COPY CentOS-Base.repo /etc/yum.repos.d/ |
| 10 | + |
| 11 | +# Install all basic requirements |
| 12 | +RUN \ |
| 13 | + yum install -y epel-release && \ |
| 14 | + yum -y update && \ |
| 15 | + yum install -y tar unzip wget xz git patchelf readline-devel libX11-devel libXt-devel \ |
| 16 | + xorg-x11-server-devel openssl-devel texlive-* && \ |
| 17 | + yum install -y $DEVTOOLSET_URL_ROOT/devtoolset-4-gcc-5.3.1-6.1.el6.x86_64.rpm \ |
| 18 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-gcc-gfortran-5.3.1-6.1.el6.x86_64.rpm \ |
| 19 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-libquadmath-devel-5.3.1-6.1.el6.x86_64.rpm \ |
| 20 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-gcc-c++-5.3.1-6.1.el6.x86_64.rpm \ |
| 21 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-binutils-2.25.1-8.el6.x86_64.rpm \ |
| 22 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-runtime-4.1-3.sc1.el6.x86_64.rpm \ |
| 23 | + $DEVTOOLSET_URL_ROOT/devtoolset-4-libstdc++-devel-5.3.1-6.1.el6.x86_64.rpm |
| 24 | + |
| 25 | +ENV PATH=/opt/python/bin:/usr/local/ninja:/opt/software/packages/bin:/opt/R/3.3.0/bin:$PATH |
| 26 | +ENV LD_LIBRARY_PATH=/opt/software/packages/lib:/opt/R/3.3.0/lib64:$LD_LIBRARY_PATH |
| 27 | +ENV CC=/opt/rh/devtoolset-4/root/usr/bin/gcc |
| 28 | +ENV CXX=/opt/rh/devtoolset-4/root/usr/bin/c++ |
| 29 | +ENV CPP=/opt/rh/devtoolset-4/root/usr/bin/cpp |
| 30 | +ENV F77=/opt/rh/devtoolset-4/root/usr/bin/gfortran |
| 31 | + |
| 32 | +# A few packages have to be built from the source because CentOS 6 is a very old distribution and |
| 33 | +# the system packages are not sufficiently up-to-date to build R 3.3.0. We'll want to update to |
| 34 | +# CentOS 7 after the 1.4.0 release. Tracking issue: dmlc/xgboost#6791. |
| 35 | +# |
| 36 | +# Why choose an old Linux distro? This is so that the resulting xgboost.so is compatible with a |
| 37 | +# wide range of Linux OSes currently in operation. See https://www.python.org/dev/peps/pep-0571/ |
| 38 | +RUN \ |
| 39 | + wget https://zlib.net/fossils/zlib-1.2.5.tar.gz && \ |
| 40 | + wget https://sourceware.org/pub/bzip2/bzip2-1.0.6.tar.gz && \ |
| 41 | + wget http://tukaani.org/xz/xz-5.2.2.tar.gz && \ |
| 42 | + wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz && \ |
| 43 | + wget https://www.openssl.org/source/old/1.0.0/openssl-1.0.0k.tar.gz && \ |
| 44 | + wget --no-check-certificate https://curl.se/download/curl-7.47.1.tar.gz && \ |
| 45 | + tar xf zlib-1.2.5.tar.gz && \ |
| 46 | + tar xf bzip2-1.0.6.tar.gz && \ |
| 47 | + tar xf xz-5.2.2.tar.gz && \ |
| 48 | + tar xf pcre-8.40.tar.gz && \ |
| 49 | + tar xf openssl-1.0.0k.tar.gz && \ |
| 50 | + tar xf curl-7.47.1.tar.gz && \ |
| 51 | + cd zlib-1.2.5 && \ |
| 52 | + ./configure --prefix=/opt/software/packages && \ |
| 53 | + make -j$(nproc) && \ |
| 54 | + make install && \ |
| 55 | + cd ../bzip2-1.0.6 && \ |
| 56 | + sed -i 's/CFLAGS=-Wall/CFLAGS=-fPIC -Wall/g' Makefile && \ |
| 57 | + make -f Makefile-libbz2_so && \ |
| 58 | + make clean && \ |
| 59 | + make -j$(nproc) && \ |
| 60 | + make -n install PREFIX=/opt/software/packages && \ |
| 61 | + make install PREFIX=/opt/software/packages && \ |
| 62 | + cd ../xz-5.2.2 && \ |
| 63 | + ./configure --prefix=/opt/software/packages && \ |
| 64 | + make -j$(nproc) && \ |
| 65 | + make install && \ |
| 66 | + cd ../pcre-8.40 && \ |
| 67 | + ./configure --enable-utf8 --prefix=/opt/software/packages && \ |
| 68 | + make -j$(nproc) && \ |
| 69 | + make install && \ |
| 70 | + cd ../curl-7.47.1 && \ |
| 71 | + ./configure --prefix=/opt/software/packages --with-ssl && \ |
| 72 | + make -j$(nproc) && \ |
| 73 | + make install && \ |
| 74 | + export CFLAGS="-I/opt/software/packages/include" && \ |
| 75 | + export LDFLAGS="-L/opt/software/packages/lib" && \ |
| 76 | + cd .. && \ |
| 77 | + # R 3.3.0 |
| 78 | + wget -nv -nc https://cran.r-project.org/src/base/R-3/R-3.3.0.tar.gz && \ |
| 79 | + tar xf R-3.3.0.tar.gz && \ |
| 80 | + cd R-3.3.0 && \ |
| 81 | + ./configure --prefix=/opt/R/3.3.0 --enable-R-shlib && \ |
| 82 | + make -j$(nproc) && \ |
| 83 | + make install && \ |
| 84 | + # Python |
| 85 | + wget -nv -nc -O Miniconda3.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ |
| 86 | + bash Miniconda3.sh -b -p /opt/python && \ |
| 87 | + /opt/python/bin/python -m pip install auditwheel && \ |
| 88 | + # CMake |
| 89 | + wget -nv -nc https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.sh --no-check-certificate && \ |
| 90 | + bash cmake-3.13.0-Linux-x86_64.sh --skip-license --prefix=/usr && \ |
| 91 | + # Ninja |
| 92 | + mkdir -p /usr/local && \ |
| 93 | + cd /usr/local/ && \ |
| 94 | + wget -nv -nc https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz --no-check-certificate && \ |
| 95 | + tar xf v1.10.0.tar.gz && mv ninja-1.10.0 ninja && rm -v v1.10.0.tar.gz && \ |
| 96 | + cd ninja && \ |
| 97 | + /opt/python/bin/python ./configure.py --bootstrap |
| 98 | + |
| 99 | +ENV GOSU_VERSION 1.10 |
| 100 | + |
| 101 | +# Install lightweight sudo (not bound to TTY) |
| 102 | +RUN set -ex; \ |
| 103 | + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \ |
| 104 | + chmod +x /usr/local/bin/gosu && \ |
| 105 | + gosu nobody true |
| 106 | + |
| 107 | +# Default entry-point to use if running locally |
| 108 | +# It will preserve attributes of created files |
| 109 | +COPY entrypoint.sh /scripts/ |
| 110 | + |
| 111 | +WORKDIR /workspace |
| 112 | +ENTRYPOINT ["/scripts/entrypoint.sh"] |
0 commit comments