morningman closed pull request #301: Add docker dev environment URL: https://github.com/apache/incubator-doris/pull/301
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docker/Docker_build.md b/docker/Docker_build.md new file mode 100644 index 00000000..e66bbe25 --- /dev/null +++ b/docker/Docker_build.md @@ -0,0 +1,26 @@ +## Doris Develop Environment based on docker +1、、Build docker image +```aidl +cd docker + +docker build -t doris:v1.0 . + +-- doris is docker image repository name and base is tag name , you can change them to what you like + +``` + +2、Use docker image +```aidl +docker run -it --name doris doris:v1.0 +// if you want to build your local code ,you should execute: +docker run -it --name test -v **/incubator-doris:/var/local/incubator-doris doris:v1.0 + +// then build source code +cd /var/local/incubator-doris + +sh build.sh -- build project + +//execute unit test +sh run-ut.sh --run -- run unit test + +``` diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..100ebece --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,82 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +FROM centos:centos7.5.1804 + +MAINTAINER tangxiaoqing214445 + +ENV DEFAULT_DIR /var/local + +# change .bashrc +RUN echo -e "if [ ! -d "/var/local/incubator-doris/thirdparty/installed" ]; then\n\tmkdir /var/local/incubator-doris/thirdparty/installed\n\tcp -rf /var/local/thirdparty/installed/* /var/local/incubator-doris/thirdparty/installed/\nfi" >> /root/.bashrc + +ARG GCC_VERSION=7.3.0 +ARG GCC_URL=https://mirrors.ustc.edu.cn/gnu/gcc/gcc-${GCC_VERSION} + +# install dependencies and build gcc +RUN yum install -y bzip2 wget gcc-c++ libstdc++-static cmake byacc flex automake libtool binutils-devel bison ncurses-devel make mlocate unzip patch which vim-common redhat-lsb-core zip \ + && updatedb \ + && mkdir -p /var/local/gcc \ + && curl -fsSL -o /tmp/gcc.tar.gz ${GCC_URL}/gcc-${GCC_VERSION}.tar.gz \ + && tar -xzf /tmp/gcc.tar.gz -C /var/local/gcc --strip-components=1 \ + && cd /var/local/gcc \ + && sed -i 's/ftp:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure\//http:\/\/mirror.linux-ia64.org\/gnu\/gcc\/infrastructure\//g' contrib/download_prerequisites \ + && ./contrib/download_prerequisites \ + && ./configure --disable-multilib --enable-languages=c,c++ --prefix=/usr \ + && make -j 4 && make install \ + && rm -rf /var/local/gcc \ + && rm -f /tmp/gcc.tar.gz + +# install maven 3.6.0 +ARG MAVEN_VERSION=3.6.0 +ARG SHA=fae9c12b570c3ba18116a4e26ea524b29f7279c17cbaadc3326ca72927368924d9131d11b9e851b8dc9162228b6fdea955446be41207a5cfc61283dd8a561d2f +ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries + +RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ + && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ + && echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \ + && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ + && rm -f /tmp/apache-maven.tar.gz \ + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn + +ENV MAVEN_HOME /usr/share/maven + +# build environment +WORKDIR ${DEFAULT_DIR} + +# download third party, you should download latest third party if you build the latest code +ARG DORIS_THRIDPARTY_URL=http://doris-opensource.bj.bcebos.com/doris-thirdparty-20181102.tar.gz?authorization=bce-auth-v1/069fc2786e464e63a5f1183824ddb522/2018-11-02T09:27:57Z/-1/host/b30621ca2be77596cec9477f6cfb3608b681206d73084338d1b2f1204a3e3848 + +# clone source code and build third party +RUN yum install -y git \ + && git clone https://github.com/apache/incubator-doris.git \ + && mkdir -p ${DEFAULT_DIR}/thirdparty/src ${DEFAULT_DIR}/doris-thirdparty \ + && cp -rf ${DEFAULT_DIR}/incubator-doris/thirdparty/* ${DEFAULT_DIR}/thirdparty/ \ + && curl -fsSL -o ${DEFAULT_DIR}/doris-thirdparty.tar.gz ${DORIS_THRIDPARTY_URL} \ + && tar -zxf ${DEFAULT_DIR}/doris-thirdparty.tar.gz -C ${DEFAULT_DIR}/doris-thirdparty --strip-components=1 \ + && mv ${DEFAULT_DIR}/doris-thirdparty/* ${DEFAULT_DIR}/thirdparty/src/ \ + && /bin/bash thirdparty/build-thirdparty.sh \ + && ln -s ${DEFAULT_DIR}/thirdparty/installed/bin/thrift /usr/bin/thrift \ + && ln -s ${DEFAULT_DIR}/thirdparty/installed/jdk1.8.0_131/bin/java /usr/bin/java \ + && rm -rf ${DEFAULT_DIR}/thirdparty/src \ + && rm -rf ${DEFAULT_DIR}/doris-thirdparty.tar.gz \ + && rm -rf ${DEFAULT_DIR}/doris-thirdparty + +ENV JAVA_HOME ${DEFAULT_DIR}/thirdparty/installed/jdk1.8.0_131 + +WORKDIR ${DEFAULT_DIR}/incubator-doris + ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
