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

ARG HOME_DIR=/root
8
ARG DOCKER_CONFIG_DIR=${HOME_DIR}/docker
羽飞's avatar
羽飞 已提交
9 10 11 12

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

羽飞's avatar
docker  
羽飞 已提交
19
# clone deps and compile deps
20
# RUN mkdir -p ${HOME_DIR}/deps
羽飞's avatar
docker  
羽飞 已提交
21
WORKDIR ${HOME_DIR}/deps
羽飞's avatar
羽飞 已提交
22

23
RUN git clone https://gitee.com/mirrors/libevent.git  -b release-2.1.12-stable  \
羽飞's avatar
docker  
羽飞 已提交
24
    && mkdir -p ${HOME_DIR}/deps/libevent/build  \
W
wangyunlai.wyl 已提交
25 26
    && 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  
羽飞 已提交
27
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
28

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

35
RUN git clone https://gitee.com/mirrors/googletest.git \
羽飞's avatar
docker  
羽飞 已提交
36
    && mkdir -p ${HOME_DIR}/deps/googletest/build  \
W
wangyunlai.wyl 已提交
37 38
    && cmake -B ${HOME_DIR}/deps/googletest/build ${HOME_DIR}/deps/googletest \
    && make -C ${HOME_DIR}/deps/googletest/build -j install \
羽飞's avatar
docker  
羽飞 已提交
39
    && rm -rf ${HOME_DIR}/deps/*
羽飞's avatar
羽飞 已提交
40

羽飞's avatar
docker  
羽飞 已提交
41 42 43 44 45 46
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
羽飞 已提交
47

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
# install openssh
RUN yum -y install openssh openssh-clients openssh-server

# change root password
RUN echo "root:root" | chpasswd
RUN mkdir /var/run/sshd

# install zsh and on-my-zsh
RUN yum install -y zsh \
    && git clone https://gitee.com/mirrors/ohmyzsh.git ~/.oh-my-zsh \
    && cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
    && sed -i "s/robbyrussell/bira/" ~/.zshrc \
    && usermod --shell /bin/zsh root \
    && echo "export LD_LIBRARY_PATH=/usr/local/lib64:\$LD_LIBRARY_PATH" >> ~/.zshrc

RUN mkdir -p ${DOCKER_CONFIG_DIR}/bin
RUN mkdir -p ${DOCKER_CONFIG_DIR}/config

WORKDIR ${DOCKER_CONFIG_DIR}/bin

# copy vscode config files
COPY config/* ${DOCKER_CONFIG_DIR}/config/
羽飞's avatar
羽飞 已提交
70

71 72
# copy starter scripts
COPY bin/* ${DOCKER_CONFIG_DIR}/bin/
羽飞's avatar
羽飞 已提交
73

74
RUN chmod +x ${DOCKER_CONFIG_DIR}/bin/*
羽飞's avatar
羽飞 已提交
75

76
ENTRYPOINT ./starter.sh