Dockerfile 2.6 KB
Newer Older
羽飞's avatar
docker  
羽飞 已提交
1 2 3
# how to use
# docker build -t miniob .
# make sure docker has been installed
羽飞's avatar
羽飞 已提交
4 5
# FROM rockylinux:8
FROM openanolis/anolisos:8.6
羽飞's avatar
羽飞 已提交
6 7 8 9 10 11 12

ARG HOME_DIR=/root
ARG GIT_SOURCE=github

ENV LANG=en_US.UTF-8

# install rpm
羽飞's avatar
羽飞 已提交
13 14 15 16 17
# note: gcc-c++ in rockylinux 8 and gcc-g++ in rockylinux 9. use `dnf groupinfo "Development Tools"` to list the tools
RUN dnf install -y make cmake git wget which flex gdb gcc gcc-c++ diffutils readline-devel texinfo
# rockylinux:9 RUN dnf --enablerepo=crb install -y texinfo
# rockylinux:8
# RUN dnf --enablerepo=powertools install -y texinfo
羽飞's avatar
羽飞 已提交
18 19 20

# prepare env
WORKDIR ${HOME_DIR}
羽飞's avatar
羽飞 已提交
21 22
RUN echo alias ls=\"ls --color=auto\" >> .bashrc
RUN echo "export LD_LIBRARY_PATH=/usr/local/lib64:\$LD_LIBRARY_PATH" >> .bashrc
羽飞's avatar
羽飞 已提交
23

羽飞's avatar
docker  
羽飞 已提交
24 25 26
# clone deps and compile deps
RUN mkdir -p ${HOME_DIR}/deps
WORKDIR ${HOME_DIR}/deps
羽飞's avatar
羽飞 已提交
27

羽飞's avatar
docker  
羽飞 已提交
28 29
RUN git clone https://github.com/libevent/libevent  -b release-2.1.12-stable  \
    && mkdir -p ${HOME_DIR}/deps/libevent/build  \
W
wangyunlai.wyl 已提交
30 31
    && 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  
羽飞 已提交
32
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
33

羽飞's avatar
docker  
羽飞 已提交
34 35
RUN git clone https://github.com/open-source-parsers/jsoncpp.git \
    && mkdir -p ${HOME_DIR}/deps/jsoncpp/build \
W
wangyunlai.wyl 已提交
36 37
    && 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  
羽飞 已提交
38 39 40 41
    && rm -rf ${HOME_DIR}/deps/*

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

羽飞's avatar
docker  
羽飞 已提交
46 47 48 49 50 51
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
羽飞 已提交
52 53 54 55 56

# 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  
羽飞 已提交
57
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
羽飞 已提交
58 59
RUN mkdir -p ${HOME_DIR}/source/miniob/build
WORKDIR ${HOME_DIR}/source/miniob/build
羽飞's avatar
docker  
羽飞 已提交
60 61 62
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
羽飞 已提交
63 64 65

WORKDIR ${HOME_DIR}

羽飞's avatar
羽飞 已提交
66
ENTRYPOINT tail -f /dev/null
羽飞's avatar
羽飞 已提交
67