From centos:centos7
RUN yum install -y wget java mysql python3 python3-devel pip3 mysql-devel gcc && \
    yum clean all && rm -rf /var/cache/yum/*

RUN version=$(curl https://api.github.com/repos/actiontech/dble/releases/latest | grep "name.*tar.gz" | cut -d '"' -f 4) && \
    wget -P /opt $(curl https://api.github.com/repos/actiontech/dble/releases/latest | grep "browser_download_url.*tar.gz" | cut -d '"' -f 4) && \
    tar zxvf /opt/$version -C /opt && \
    rm -f /opt/$version && \
    pip3 install mysqlclient -i http://pypi.douban.com/simple --trusted-host pypi.douban.com && \
    pip3 install six -i http://pypi.douban.com/simple --trusted-host pypi.douban.com && \
    pip3 install coloredlogs -i http://pypi.douban.com/simple --trusted-host pypi.douban.com && \
    pip3 install rsa -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

COPY quick-start/db_mgr.xml /opt/dble/conf/db.xml
COPY quick-start/user.xml /opt/dble/conf/
COPY quick-start/sharding.xml /opt/dble/conf/

COPY quick-start/*.cnf /opt/dble/conf/
COPY quick-start/docker_init_start.sh /opt/dble/bin/
COPY quick-start/start_mgr.sh /opt/dble/bin/
COPY wait-for-it.sh /opt/dble/bin/

RUN chmod 777 /opt/dble/bin/*

VOLUME /opt/dble

CMD ["/opt/dble/bin/docker_init_start.sh startMgr"]
