Skip to content

Commit

Permalink
Add centos dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinglu committed Sep 10, 2019
1 parent ae9481b commit 73e797f
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM centos:7

LABEL maintainer="yee.yi@vesoft.com"

RUN yum update -y \
&& yum install -y centos-release-scl \
&& yum install -y devtoolset-8 \
&& yum install -y \
autoconf \
autoconf-archive \
automake \
file \
git \
java-1.8.0-openjdk \
libtool \
make \
maven \
ncurses-devel \
perl \
perl-WWW-Curl \
readline-devel \
rpm-build \
unzip \
vim \
wget \
xz-devel \
&& yum clean all \
&& rm -rf /var/cache/yum

RUN scl enable devtoolset-8 -- bash \
&& mkdir -p /home/nebula \
&& ln -snf /opt/rh/devtoolset-8/enable /etc/profile.d/devtoolset-8.sh

ENV NEBULA_HOME /home/nebula

WORKDIR ${NEBULA_HOME}

COPY ./install-deps.sh ${NEBULA_HOME}/

RUN ${NEBULA_HOME}/install-deps.sh

# Build and Install thirdparty
RUN git clone --single-branch --branch master https://github.com/vesoft-inc/nebula-3rdparty.git ${NEBULA_HOME}/nebula-3rdparty \
&& cd ${NEBULA_HOME}/nebula-3rdparty \
&& . /etc/profile.d/devtoolset-8.sh \
&& cmake -DSKIP_JAVA_JAR=ON . \
&& make && make install \
&& cd ${NEBULA_HOME} \
&& rm -rf ${NEBULA_HOME}/*
65 changes: 65 additions & 0 deletions install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh

set -ex

INSTALL_PATH=/opt/rh/devtoolset-8/root/usr
NEBULA_HOME=/home/nebula
EXTRA_CXXFLAGS="-O2 -m64 -march=x86-64"
EXTRA_PIC_CXXFLAGS="${EXTRA_CXXFLAGS} -fPIC -DPIC"
EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"

. /etc/profile.d/devtoolset-8.sh

# Install openssl-1.1.0h
wget -qO - https://www.openssl.org/source/old/1.1.0/openssl-1.1.0h.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/openssl-1.1.0h
./config --prefix=${INSTALL_PATH} --openssldir=${INSTALL_PATH}/ssl no-shared threads ${EXTRA_CXXFLAGS} ${EXTRA_LDFLAGS}
make && make install

# Install cmake-3.11.4
wget -qO - https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/cmake-3.11.4
CXXFLAGS=${EXTRA_PIC_CXXFLAGS} CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS="${EXTRA_LDFLAGS} -pthread" ./configure --prefix=${INSTALL_PATH}
make && make install

# Install bison-3.0.5
wget -qO - http://ftp.gnu.org/gnu/bison/bison-3.0.5.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/bison-3.0.5
CXXFLAGS=${EXTRA_PIC_CXXFLAGS} CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS=${EXTRA_LDFLAGS} ./configure --prefix=${INSTALL_PATH} --enable-shared=no --enable-static
make && make install

# Install flex-2.6.4
wget -qO - https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/flex-2.6.4
CXXFLAGS=${EXTRA_PIC_CXXFLAGS} CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS=${EXTRA_LDFLAGS} ./configure --prefix=${INSTALL_PATH} --enable-shared=no
make && make install

# Install boost-1.66
wget -qO - https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/boost_1_66_0
./bootstrap.sh --prefix=${INSTALL_PATH} --without-icu --without-libraries=python
./b2 cxxflags=${EXTRA_CXXFLAGS} link=static runtime-link=static install
./b2 --clean-all

# Install gperf-3.1
wget -qO - http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/gperf-3.1
CXXFLAGS=${EXTRA_PIC_CXXFLAGS} CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS=${EXTRA_LDFLAGS} ./configure --prefix=${INSTALL_PATH} --enable-shared=no
make && make install

# Install krb5-1.16.3
wget -qO - https://github.com/krb5/krb5/archive/krb5-1.16.3-final.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/krb5-krb5-1.16.3-final/src
autoreconf
CXXFLAGS=$EXTRA_PIC_CXXFLAGS CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS=${EXTRA_LDFLAGS} ./configure --prefix=${INSTALL_PATH} --enable-static --disable-shared --disable-rpath --disable-aesni --disable-thread-support
make all && make install

# Install libunwind-1.2.1
wget -qO - https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz | tar zxf - -C ${NEBULA_HOME}
cd ${NEBULA_HOME}/libunwind-1.2.1
CXXFLAGS=${EXTRA_PIC_CXXFLAGS} CFLAGS=$CXXFLAGS CPPFLAGS=$CXXFLAGS LDFLAGS=${EXTRA_LDFLAGS} ./configure --prefix=${INSTALL_PATH} --enable-shared=no
make && make install

# Cleanup
cd ${NEBULA_HOME}
rm -rf *

0 comments on commit 73e797f

Please sign in to comment.