Apache DataFusion SQL Query Engine
ARROW-3456: [CI] Reuse docker images and optimize docker-compose containers
Krisztián Szűcs1978e832f4d3
diff --git a/.dockerignore b/.dockerignoreindex 61f42f0b44..1c6bc1e124 100644--- a/.dockerignore+++ b/.dockerignore@@ -16,9 +16,11 @@# under the License..git+docker_cache# IDE.vscode+*/.vscode# c_glibc_glib/build@@ -34,7 +36,12 @@ c_glib/*/.libscpp/.ideacpp/buildcpp/*-build+cpp/*_buildcpp/Testing+cpp/thirdparty+!cpp/thirdparty/jemalloc+!cpp/thirdparty/versions.txt+!cpp/thirdparty/hadoop/include# pythonpython/builddiff --git a/.gitignore b/.gitignoreindex e54be5f821..79a2a8e13d 100644--- a/.gitignore+++ b/.gitignore@@ -41,4 +41,4 @@ python/.eggs/pkgs.Rproj.userarrow.Rcheck/-+docker_cachediff --git a/ci/conda_env_python.yml b/ci/conda_env_python.ymlindex 43022ae024..37ec65496e 100644--- a/ci/conda_env_python.yml+++ b/ci/conda_env_python.yml@@ -16,7 +16,6 @@# under the License.cython-ipythonnomklnumpypandasdiff --git a/ci/docker_build_c_glib.sh b/ci/docker_build_c_glib.shindex 7390e79369..28ef9011f1 100755--- a/ci/docker_build_c_glib.sh+++ b/ci/docker_build_c_glib.sh@@ -24,14 +24,15 @@ export ARROW_C_GLIB_HOME=$CONDA_PREFIXexport CFLAGS="-DARROW_NO_DEPRECATED_API"export CXXFLAGS="-DARROW_NO_DEPRECATED_API -D_GLIBCXX_USE_CXX11_ABI=0"-pushd arrow/c_glib- mkdir build+mkdir -p /build/c_glib- # Build with Meson- meson build --prefix=$ARROW_C_GLIB_HOME --libdir=lib+# Build with Meson+meson --prefix=$ARROW_C_GLIB_HOME \+ --libdir=lib \+ /build/c_glib \+ /arrow/c_glib- pushd build- ninja- ninja install- popd+pushd /build/c_glib+ ninja+ ninja installpopddiff --git a/ci/docker_build_cpp.sh b/ci/docker_build_cpp.shindex 16a09f3b0a..f1cf43fd1c 100755--- a/ci/docker_build_cpp.sh+++ b/ci/docker_build_cpp.sh@@ -17,6 +17,7 @@# under the License.set -e+set -o xtrace# Arrow specific environment variablesexport ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX@@ -26,8 +27,8 @@ export PARQUET_HOME=$CONDA_PREFIX# https://arrow.apache.org/docs/python/development.html#known-issuesexport CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"-mkdir -p arrow/cpp/build-pushd arrow/cpp/build+mkdir -p /build/cpp+pushd /build/cppcmake -GNinja \-DCMAKE_BUILD_TYPE=${ARROW_BUILD_TYPE:-debug} \@@ -42,7 +43,7 @@ cmake -GNinja \-DARROW_INSTALL_NAME_RPATH=${ARROW_INSTALL_NAME_RPATH:-ON} \-DARROW_EXTRA_ERROR_CONTEXT=ON \-DCMAKE_CXX_FLAGS=$CXXFLAGS \- ..+ /arrow/cppninjaninja installdiff --git a/ci/docker_build_python.sh b/ci/docker_build_python.shindex f145694d25..e89a0b44d6 100755--- a/ci/docker_build_python.sh+++ b/ci/docker_build_python.sh@@ -27,12 +27,13 @@ export PYARROW_CXXFLAGS=$CXXFLAGSexport PYARROW_CMAKE_GENERATOR=Ninja# Build pyarrow-pushd arrow/python+pushd /arrow/pythonpython setup.py build_ext \- --build-type=${ARROW_BUILD_TYPE:-debug} \+ --build-temp=/build/python \+ --build-type=${PYARROW_BUILD_TYPE:-debug} \--with-parquet \--with-plasma \- --inplace+ installpopddiff --git a/ci/docker_install_conda.sh b/ci/docker_install_conda.shindex 81d5256e08..427ee76e8e 100755--- a/ci/docker_install_conda.sh+++ b/ci/docker_install_conda.sh@@ -20,9 +20,9 @@# Exit on any errorset -e-wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh-bash miniconda.sh -b -q -p ${CONDA_PREFIX:=/opt/conda}-rm miniconda.sh+wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh+bash /tmp/miniconda.sh -b -q -p ${CONDA_PREFIX:=/opt/conda}+rm /tmp/miniconda.shln -s ${CONDA_PREFIX}/etc/profile.d/conda.sh /etc/profile.d/conda.shecho ". ${CONDA_PREFIX}/etc/profile.d/conda.sh" >> ~/.bashrcdiff --git a/dev/iwyu/run_iwyu.sh b/dev/iwyu/run_iwyu.shdeleted file mode 100755index 9e2bd7e80a..0000000000--- a/dev/iwyu/run_iwyu.sh+++ /dev/null@@ -1,72 +0,0 @@-#!/usr/bin/env bash-#-# 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.-#--# Set up environment and working directory-CLANG_VERSION=6.0-IWYU_BUILD_DIR=/arrow/cpp/docker-iwyu-IWYU_SH=/arrow/cpp/build-support/iwyu/iwyu.sh-IWYU_URL=https://github.com/include-what-you-use/include-what-you-use/archive/clang_$CLANG_VERSION.tar.gz--rm -rf $IWYU_BUILD_DIR-mkdir -p $IWYU_BUILD_DIR-pushd $IWYU_BUILD_DIR--function cleanup {- popd- rm -rf $IWYU_BUILD_DIR-}--trap cleanup EXIT--# Build IWYU-wget -O iwyu.tar.gz $IWYU_URL-tar xzf iwyu.tar.gz-rm -f iwyu.tar.gz--IWYU_SRC=`pwd`/include-what-you-use-clang_$CLANG_VERSION--export CC=clang-$CLANG_VERSION-export CXX=clang++-$CLANG_VERSION--mkdir -p iwyu-build-pushd iwyu-build--# iwyu needs this-apt-get install -y zlib1g-dev--source activate pyarrow-dev--cmake -G "Unix Makefiles" -DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$CLANG_VERSION $IWYU_SRC-make -j4-popd--# Add iwyu and iwyu_tool.py to path-export PATH=$IWYU_BUILD_DIR/iwyu-build:$PATH--export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX--cmake -GNinja \- -DARROW_PARQUET=ON \- -DARROW_PYTHON=ON \- -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' \- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..--# Make so that vendored bits are built-ninja arrow_shared--$IWYU_SH alldiff --git a/dev/lint/Dockerfile b/dev/lint/Dockerfileindex 9b9d2c564c..71d7ec85a8 100644--- a/dev/lint/Dockerfile+++ b/dev/lint/Dockerfile@@ -15,34 +15,17 @@# specific language governing permissions and limitations# under the License.-FROM ubuntu:18.04+FROM arrow:python-3.6-RUN apt-get update && \- apt-get install -y \- gcc \- g++ \- git \- wget \- pkg-config \- ninja-build \- clang-format \- clang-tidy+RUN apt-get install -y -q \+ libclang-dev \+ clang \+ clang-format \+ clang-tidy \+ iwyu-ENV CC=gcc \- CXX=g++ \- PATH=/opt/conda/bin:$PATH \- CONDA_PREFIX=/opt/conda--ADD ci/docker_install_conda.sh \- ci/conda_env_cpp.yml \- /arrow/ci/-RUN arrow/ci/docker_install_conda.sh && \- conda install -c conda-forge \- --file arrow/ci/conda_env_cpp.yml flake8 && \+RUN conda install -c conda-forge flake8 && \conda clean --all -y-ADD dev/lint/run_checks.sh /run_checks.sh-ADD dev/lint/run_clang_format.sh /run_clang_format.sh--WORKDIR /tmp-CMD /run_checks.sh+# https://bugs.launchpad.net/ubuntu/+source/iwyu/+bug/1769334+RUN ln -sv /usr/lib/clang/6.0 /usr/lib/clang/5.0.1diff --git a/dev/lint/run_clang_format.sh b/dev/lint/run_clang_format.shindex 2f70836c28..1f0f28b26b 100755--- a/dev/lint/run_clang_format.sh+++ b/dev/lint/run_clang_format.sh@@ -18,8 +18,8 @@set -ex-mkdir build_cpp-pushd build_cpp-cmake -GNinja /arrow/cpp-ninja format+mkdir -p /build/lint+pushd /build/lint+ cmake -GNinja /arrow/cpp+ ninja formatpopddiff --git a/dev/iwyu/Dockerfile b/dev/lint/run_iwyu.shold mode 100644new mode 100755similarity index 63%rename from dev/iwyu/Dockerfilerename to dev/lint/run_iwyu.shindex 817472056b..3f39357ae3--- a/dev/iwyu/Dockerfile+++ b/dev/lint/run_iwyu.sh@@ -1,3 +1,4 @@+#!/usr/bin/env bash## Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with@@ -15,9 +16,21 @@# limitations under the License.#-FROM arrow_integration_xenial_base+export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX-ADD dev/iwyu/run_iwyu.sh /run_iwyu.sh+mkdir -p /build/lint+pushd /build/lint-WORKDIR /tmp-CMD /run_iwyu.sh\ No newline at end of file+cmake -GNinja \+ -DARROW_PARQUET=ON \+ -DARROW_PYTHON=ON \+ -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' \+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \+ /arrow/cpp+# Make so that vendored bits are built+ninja arrow_shared++popd++export IWYU_COMPILATION_DATABASE_PATH=/build/lint+/arrow/cpp/build-support/iwyu/iwyu.sh alldiff --git a/dev/lint/run_checks.sh b/dev/lint/run_linters.shsimilarity index 82%rename from dev/lint/run_checks.shrename to dev/lint/run_linters.shindex 6e7a63d8ee..1b549aa40e 100755--- a/dev/lint/run_checks.sh+++ b/dev/lint/run_linters.sh@@ -18,14 +18,14 @@set -ex-mkdir build_cpp-pushd build_cpp-cmake -GNinja /arrow/cpp-ninja check-format-ninja lint+mkdir -p /build/lint+pushd /build/lint+ cmake -GNinja /arrow/cpp+ ninja check-format+ ninja lintpopdpushd /arrow/python-flake8 --count pyarrow-flake8 --count --config=.flake8.cython pyarrow+ flake8 --count pyarrow+ flake8 --count --config=.flake8.cython pyarrowpopddiff --git a/docker-compose.yml b/docker-compose.ymlindex 62c300328c..9ee2b445d7 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -15,33 +15,54 @@# specific language governing permissions and limitations# under the License.+# Development containers for Arrow+version: '3.5'-services:- # we can further improve the caching mechanism for go rust and js via- # early adding the dependencies explicitly (cargo.toml etc) to prevent- # reinstalling the dependencies on each modification+x-volumes:+ &volumes+ - .:/arrow:delegated+ - ${ARROW_DOCKER_CACHE_DIR:-./docker_cache}:/build:delegated++services:######################### Language Containers ###############################+ #TODO(kszucs): R+c_glib:+ # Usage:+ # docker-compose build cpp+ # docker-compose build c_glib+ # docker-compose run c_glibimage: arrow:c_glibbuild:context: .dockerfile: c_glib/Dockerfile+ volumes: *volumescpp:+ # Usage:+ # docker-compose build cpp+ # docker-compose run cppimage: arrow:cppshm_size: 2Gbuild:context: .dockerfile: cpp/Dockerfile+ environment:+ PARQUET_TEST_DATA: /arrow/cpp/submodules/parquet-testing/data+ volumes: *volumesgo:+ # Usage:+ # docker-compose build go+ # docker-compose run goimage: arrow:gobuild:context: .dockerfile: go/Dockerfile+ volumes: *volumesjava:image: arrow:java@@ -56,6 +77,11 @@ services:dockerfile: js/Dockerfilepython:+ # Usage:+ # export PYTHON_VERSION=3.6+ # docker-compose build cpp+ # docker-compose build python+ # docker-compose run pythonimage: arrow:python-${PYTHON_VERSION:-3.6}shm_size: 2Gbuild:@@ -63,14 +89,52 @@ services:dockerfile: python/Dockerfileargs:PYTHON_VERSION: ${PYTHON_VERSION:-3.6}-- #TODO(kszucs): R+ volumes: *volumesrust:+ # Usage:+ # docker-compose build rust+ # docker-compose run rustimage: arrow:rustbuild:context: .dockerfile: rust/Dockerfile+ volumes: *volumes++ ######################### Tools and Linters #################################++ # TODO(kszucs): site+ # TODO(kszucs): apidoc++ lint:+ # Usage:+ # docker-compose build lint+ # docker-compose run lint+ image: arrow:lint+ build:+ context: .+ dockerfile: dev/lint/Dockerfile+ command: arrow/dev/lint/run_linters.sh+ volumes: *volumes++ iwyu:+ # Usage:+ # docker-compose build lint+ # docker-compose run iwyu+ image: arrow:lint+ environment:+ CC: clang+ CXX: clang+++ command: arrow/dev/lint/run_iwyu.sh+ volumes: *volumes++ clang-format:+ # Usage:+ # docker-compose build lint+ # docker-compose run clang-format+ image: arrow:lint+ command: arrow/dev/lint/run_clang_format.sh+ volumes: *volumes######################### Integration Tests #################################@@ -100,6 +164,12 @@ services:- hdfs-namenode:hdfs-namenodehdfs-integration:+ # Usage:+ # export PYTHON_VERSION=3.6+ # docker-compose build cpp+ # docker-compose build python+ # docker-compose build hdfs-integration+ # docker-compose run hdfs-integrationlinks:- hdfs-namenode:hdfs-namenode- hdfs-datanode:hdfs-datanode@@ -111,39 +181,6 @@ services:context: .dockerfile: integration/hdfs/Dockerfile- lint:- image: arrow:lint- shm_size: 2G- build:- context: .- dockerfile: dev/lint/Dockerfile- volumes:- - .:/arrow:delegated-- # Depends on xenial base image, see dev/README.md- iwyu:- image: arrow:iwyu- build:- context: .- dockerfile: dev/iwyu/Dockerfile- volumes:- - .:/arrow:delegated-- clang-format:- image: arrow:lint- shm_size: 2G- command: '/run_clang_format.sh'- build:- context: .- dockerfile: dev/lint/Dockerfile- volumes:- - .:/arrow:delegated-# TODO(kszucs): dask-integration# TODO(kszucs): hive-integration# TODO(kszucs): spark-integration-- ######################### Documentation #####################################-- # TODO(kszucs): site- # TODO(kszucs): apidocdiff --git a/integration/hdfs/Dockerfile b/integration/hdfs/Dockerfileindex 87d4e31489..a1d3e4eb0a 100644--- a/integration/hdfs/Dockerfile+++ b/integration/hdfs/Dockerfile@@ -19,6 +19,9 @@ FROM gelog/hadoopRUN apt-get update && \apt-get install -y \+ autoconf \+ automake \+ make \gcc \g++ \git \diff --git a/rust/Dockerfile b/rust/Dockerfileindex 6ad57c3e2a..c63dcda79d 100644--- a/rust/Dockerfile+++ b/rust/Dockerfile@@ -17,8 +17,10 @@FROM rust-ADD rust /arrow/rust+# sadly cargo doesn't have a command to fetch and build the+# dependencies without building the library itself+ENV CARGO_TARGET_DIR=/build/rust+ADD rust/Cargo.toml /arrow/rust/Cargo.tomlWORKDIR /arrow/rust-RUN cargo buildCMD cargo test