avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r1651069 - in /avro/trunk: BUILD.txt CHANGES.txt build.sh share/docker/ share/docker/Dockerfile share/rat-excludes.txt
Date Mon, 12 Jan 2015 12:11:56 GMT
Author: tomwhite
Date: Mon Jan 12 12:11:55 2015
New Revision: 1651069

URL: http://svn.apache.org/r1651069
Log:
AVRO-1537. Make it easier to set up a multi-language build environment.

Added:
    avro/trunk/share/docker/
    avro/trunk/share/docker/Dockerfile
Modified:
    avro/trunk/BUILD.txt
    avro/trunk/CHANGES.txt
    avro/trunk/build.sh
    avro/trunk/share/rat-excludes.txt

Modified: avro/trunk/BUILD.txt
URL: http://svn.apache.org/viewvc/avro/trunk/BUILD.txt?rev=1651069&r1=1651068&r2=1651069&view=diff
==============================================================================
--- avro/trunk/BUILD.txt (original)
+++ avro/trunk/BUILD.txt Mon Jan 12 12:11:55 2015
@@ -21,9 +21,25 @@ The following packages must be installed
  - Apache Forrest 0.8 (for documentation)
  - md5sum, sha1sum, used by top-level dist target
 
+To simplify this, you can run a Docker container with all the above
+dependencies installed by installing docker.io and typing:
+
+ ./build.sh docker
+
+When this completes you will be in a shell running in the
+container. Building the image the first time may take a while (20
+minutes or more) since dependencies must be downloaded and
+installed. However subsequent invocations are much faster as the
+cached image is used.
+
+The working directory in the container is mounted from your host. This
+allows you to access the files in your Avro development tree from the
+Docker container.
+
 BUILDING
 
-Once the requirements are installed, build.sh can be used as follows:
+Once the requirements are installed (or from the Docker container),
+build.sh can be used as follows:
 
  './build.sh test' runs tests for all languages
  './build.sh dist' creates all release distribution files in dist/

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1651069&r1=1651068&r2=1651069&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Jan 12 12:11:55 2015
@@ -36,6 +36,10 @@ Trunk (not yet released)
     field sub-builders, permitting easier creation of nested, optional
     structures. (Niels Basjes via cutting)
 
+    AVRO-1537. Make it easier to set up a multi-language build environment.
+    Support for running a Docker container with all build dependencies.
+    (tomwhite)
+
   OPTIMIZATIONS
 
   IMPROVEMENTS

Modified: avro/trunk/build.sh
URL: http://svn.apache.org/viewvc/avro/trunk/build.sh?rev=1651069&r1=1651068&r2=1651069&view=diff
==============================================================================
--- avro/trunk/build.sh (original)
+++ avro/trunk/build.sh Mon Jan 12 12:11:55 2015
@@ -22,7 +22,7 @@ cd `dirname "$0"`				  # connect to root
 VERSION=`cat share/VERSION.txt`
 
 function usage {
-  echo "Usage: $0 {test|dist|sign|clean}"
+  echo "Usage: $0 {test|dist|sign|clean|docker}"
   exit 1
 }
 
@@ -172,6 +172,35 @@ case "$target" in
 	(cd lang/perl; [ -f Makefile ] && make clean)
 	;;
 
+    docker)
+        docker build -t avro-build share/docker
+        if [ "$(uname -s)" == "Linux" ]; then
+          USER_NAME=${SUDO_USER:=$USER}
+          USER_ID=$(id -u $USER_NAME)
+          GROUP_ID=$(id -g $USER_NAME)
+        else # boot2docker uid and gid
+          USER_NAME=$USER
+          USER_ID=1000
+          GROUP_ID=50
+        fi
+        docker build -t avro-build-${USER_NAME} - <<UserSpecificDocker
+FROM avro-build
+RUN groupadd -g ${GROUP_ID} ${USER_NAME} || true
+RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
+ENV HOME /home/${USER_NAME}
+UserSpecificDocker
+        # By mapping the .m2 directory you can do an mvn install from
+        # within the container and use the result on your normal
+        # system.  And this also is a significant speedup in subsequent
+        # builds because the dependencies are downloaded only once.
+        docker run --rm=true -t -i \
+          -v ${PWD}:/home/${USER_NAME}/avro \
+          -w /home/${USER_NAME}/avro \
+          -v ${HOME}/.m2:/home/${USER_NAME}/.m2 \
+          -u ${USER_NAME} \
+          avro-build-${USER_NAME}
+        ;;
+
     *)
         usage
         ;;

Added: avro/trunk/share/docker/Dockerfile
URL: http://svn.apache.org/viewvc/avro/trunk/share/docker/Dockerfile?rev=1651069&view=auto
==============================================================================
--- avro/trunk/share/docker/Dockerfile (added)
+++ avro/trunk/share/docker/Dockerfile Mon Jan 12 12:11:55 2015
@@ -0,0 +1,54 @@
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Avro.
+# See BUILD.txt.
+
+FROM dockerfile/java:openjdk-7-jdk
+
+WORKDIR /root
+
+# Install dependencies from packages
+RUN apt-get update && apt-get install --no-install-recommends -y \
+  git subversion curl ant make maven \
+  gcc cmake asciidoc source-highlight \
+  g++ flex bison libboost-all-dev doxygen \
+  mono-devel mono-gmcs nunit \
+  nodejs nodejs-legacy npm \
+  perl \
+  php5 phpunit php5-gmp \
+  python python-setuptools python3-setuptools \
+  ruby ruby-dev rake
+
+# Install Forrest
+RUN mkdir -p /usr/local/apache-forrest
+RUN curl -O http://archive.apache.org/dist/forrest/0.8/apache-forrest-0.8.tar.gz
+RUN tar xzf *forrest* --strip-components 1 -C /usr/local/apache-forrest
+RUN echo 'forrest.home=/usr/local/apache-forrest' > build.properties
+
+# Install Perl modules
+RUN curl -L http://cpanmin.us | perl - --self-upgrade # non-interactive cpan
+RUN cpanm install Module::Install Module::Install::ReadmeFromPod \
+  Module::Install::Repository \
+  Math::BigInt JSON::XS Try::Tiny Regexp::Common Encode \
+  IO::String Object::Tiny Compress::Zlib Test::More \
+  Test::Exception Test::Pod
+
+# Install Ruby modules
+RUN gem install echoe yajl-ruby multi_json
+
+# Install global Node modules
+RUN npm install -g grunt-cli

Modified: avro/trunk/share/rat-excludes.txt
URL: http://svn.apache.org/viewvc/avro/trunk/share/rat-excludes.txt?rev=1651069&r1=1651068&r2=1651069&view=diff
==============================================================================
--- avro/trunk/share/rat-excludes.txt (original)
+++ avro/trunk/share/rat-excludes.txt Mon Jan 12 12:11:55 2015
@@ -8,6 +8,7 @@
 **/*.js
 **/*.la
 **/*.m4
+**/*.md
 **/*.md5
 **/*.pom
 **/*.properties



Mime
View raw message