Dockerfile 2.8 KB
Newer Older
羽飞's avatar
docker  
羽飞 已提交
1 2 3 4
# how to use
# docker build -t miniob .
# make sure docker has been installed

羽飞's avatar
羽飞 已提交
5 6 7 8 9 10 11
FROM centos:7

ARG HOME_DIR=/root
ARG GIT_SOURCE=github

ENV LANG=en_US.UTF-8

12 13 14
# install gdb
RUN yum install -y gdb

羽飞's avatar
羽飞 已提交
15
# install rpm
羽飞's avatar
docker  
羽飞 已提交
16
RUN yum install -y make git wget centos-release-scl scl-utils which flex
羽飞's avatar
羽飞 已提交
17 18 19 20 21 22 23 24 25 26

# prepare env
RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++
WORKDIR ${HOME_DIR}
RUN echo "export PATH=/opt/rh/devtoolset-11/root/bin:/usr/local/oceanbase/devtools/bin:$PATH" >> .bashrc
RUN echo "export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH" >> .bashrc

ENV PATH /opt/rh/devtoolset-11/root/bin:/usr/local/oceanbase/devtools/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/lib64:$LD_LIBRARY_PATH

羽飞's avatar
docker  
羽飞 已提交
27 28 29
# clone deps and compile deps
RUN mkdir -p ${HOME_DIR}/deps
WORKDIR ${HOME_DIR}/deps
L
leauny 已提交
30 31
RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.sh \
    && bash cmake-3.24.0-linux-x86_64.sh --prefix=/usr/local/ --exclude-subdir && rm -f cmake-3.24.0-linux-x86_64.sh
羽飞's avatar
羽飞 已提交
32

羽飞's avatar
docker  
羽飞 已提交
33 34
RUN git clone https://github.com/libevent/libevent  -b release-2.1.12-stable  \
    && mkdir -p ${HOME_DIR}/deps/libevent/build  \
W
wangyunlai.wyl 已提交
35 36
    && cmake -DEVENT__DISABLE_OPENSSL=ON -B ${HOME_DIR}/deps/libevent/build ${HOME_DIR}/deps/libevent \
    && make -C ${HOME_DIR}/deps/libevent/build -j install \
羽飞's avatar
docker  
羽飞 已提交
37
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
38

羽飞's avatar
docker  
羽飞 已提交
39 40
RUN git clone https://github.com/open-source-parsers/jsoncpp.git \
    && mkdir -p ${HOME_DIR}/deps/jsoncpp/build \
W
wangyunlai.wyl 已提交
41 42
    && cmake -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF -B ${HOME_DIR}/deps/jsoncpp/build ${HOME_DIR}/deps/jsoncpp/ \
    && make -C ${HOME_DIR}/deps/jsoncpp/build -j install \
羽飞's avatar
docker  
羽飞 已提交
43 44 45 46
    && rm -rf ${HOME_DIR}/deps/*

RUN git clone https://github.com/google/googletest \
    && mkdir -p ${HOME_DIR}/deps/googletest/build  \
W
wangyunlai.wyl 已提交
47 48
    && cmake -B ${HOME_DIR}/deps/googletest/build ${HOME_DIR}/deps/googletest \
    && make -C ${HOME_DIR}/deps/googletest/build -j install \
羽飞's avatar
docker  
羽飞 已提交
49
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
50

羽飞's avatar
docker  
羽飞 已提交
51 52 53 54 55 56
RUN wget http://ftp.gnu.org/gnu/bison/bison-3.7.tar.gz \
    && tar xzvf bison-3.7.tar.gz \
    && cd bison-3.7 \
    && ./configure --prefix=/usr/local \
    && make -j install \
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
57 58 59 60 61

# clone miniob code
RUN mkdir -p ${HOME_DIR}/source
WORKDIR ${HOME_DIR}/source
RUN git clone https://${GIT_SOURCE}.com/oceanbase/miniob
羽飞's avatar
docker  
羽飞 已提交
62
RUN echo "mkdir -p build && cd build && cmake .. -DDEBUG=ON -DCMAKE_C_COMPILER=`which gcc` -DCMAKE_CXX_COMPILER=`which g++` && make -j4" > ${HOME_DIR}/source/miniob/build.sh && chmod +x ${HOME_DIR}/source/miniob/build.sh
羽飞's avatar
羽飞 已提交
63 64
RUN mkdir -p ${HOME_DIR}/source/miniob/build
WORKDIR ${HOME_DIR}/source/miniob/build
羽飞's avatar
docker  
羽飞 已提交
65 66 67
RUN cmake -B ${HOME_DIR}/source/miniob/build -DDEBUG=ON -DCMAKE_C_COMPILER=`which gcc` -DCMAKE_CXX_COMPILER=`which g++` ${HOME_DIR}/source/miniob/ \
    && make -j4 \
    && rm -rf ${HOME_DIR}/source/miniob/build
羽飞's avatar
羽飞 已提交
68 69 70 71 72

WORKDIR ${HOME_DIR}

ENTRYPOINT exec /sbin/init