# 构造gsd基础镜像
FROM ubuntu:18.04

MAINTAINER <lishengyin, lishengyin@sz-sunwin.com>

ARG with_drogon_code=yes
ARG with_zltoolkit_code=yes
ARG with_kafka_code=yes

# install基础依赖
RUN apt-get upgrade && apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    libmysqlclient-dev \
    cmake \ 
    make \
    build-essential \
    libssl-dev \
    uuid-dev \
    git \
    gcc \
    g++ \
    libjsoncpp-dev \
    openssl \
    libssl-dev \
    zlib1g-dev \
    libhiredis-dev \
    libboost-all-dev \
    libsasl2-dev \
    libzstd-dev 
    

RUN if [ "$with_drogon_code"  = "yes" ]; then \
        apt remove ca-certificates && apt install ca-certificates && \
        cd /root && git clone https://gitee.com/an-tao/drogon.git && \
        cd /root/drogon && git submodule update --init && mkdir build && cd build &&\
        cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4 && make install && \
        rm -rf /root/drogon; \
    fi 


RUN if [ "$with_zltoolkit_code" = "yes" ]; then \
        cd /root && git clone https://gitee.com/xia-chu/ZLToolKit.git ZLToolKit && \
        cd /root/ZLToolKit && sed -i 's/CMAKE_CXX_STANDARD 14/CMAKE_CXX_STANDARD 17/g' CMakeLists.txt && \
        sed -i 's/sudo//g' build_for_linux.sh  && ./build_for_linux.sh && \
        rm -rf /root/ZLToolKit; \
    fi



WORKDIR /root

