Repository: incubator-trafficcontrol Updated Branches: refs/heads/master 7d35ccc62 -> 3735477aa
add notes on using docker-compose for builds Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e4080535 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e4080535 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e4080535 Branch: refs/heads/master Commit: e408053577940e6f8af7ac2fd9273eea8179e1c9 Parents: 3e5b79e Author: Dan Kirkwood <[email protected]> Authored: Wed Oct 19 14:17:13 2016 -0600 Committer: Dan Kirkwood <[email protected]> Committed: Wed Oct 19 14:17:13 2016 -0600 ---------------------------------------------------------------------- build/README.md | 24 ++++++++++++ build/docker-build.sh | 94 ---------------------------------------------- 2 files changed, 24 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e4080535/build/README.md ---------------------------------------------------------------------- diff --git a/build/README.md b/build/README.md index cae71d9..8575572 100644 --- a/build/README.md +++ b/build/README.md @@ -1,6 +1,30 @@ # Rpm Build Instructions +## Using `docker-compose` + +We are moving toward using a docker-based build system. This eliminates the need to maintain a local installation with all the +build tools as well as ensuring that you are using the same versions as we use for testing. + +These are the versions of these tools we are using: +* docker 1.12.2 +* docker-compose 1.8.1 + +You can build from any repository/branch combination, but that repository must be available to `git clone ...`. Note that in the +following `docker-compose` commands, you can limit building to one or more sub-projects by supplying arguments at the end. If none +are supplied, then *all* will be run. + +Starting at the top-level of your trafficcontrol git clone (e.g. `~/src/incubator-trafficcontrol`): + +> cd infrastructure/docker/build +> docker-compose build traffic_ops_build traffic_monitor_build ... +> GITREPO=https://github.com/username/incubator-trafficcontrol BRANCH=mybranch docker-compose up traffic_ops_build traffic_monitor_build ... + +The resulting `.rpm` files will be created in the `artifacts` directory. + + +## Building the old-fashioned way + rpm files for all sub-projects can be built using the file `build/build.sh`. If this script is given parameters, it will build only those projects specified on the command line, e.g. `$ ./build/build.sh traffic_ops`. The prerequisites for each sub-project are listed below. http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e4080535/build/docker-build.sh ---------------------------------------------------------------------- diff --git a/build/docker-build.sh b/build/docker-build.sh deleted file mode 100755 index 01005be..0000000 --- a/build/docker-build.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# docker-build.sh creates containers for building each component of traffic_control with -# all needed dependencies. Once the build is complete, all rpms are copied into the "dist" -# directory in the current directory. -# -# Usage: docker-build.sh [<options>] -# Options: -# -r <gitrepo> git repository to clone from (defaults to value of GITREPO env variable or -# `https://github.com/Comcast/traffic_control'). Can be a URI or local directory. -# -b <branch> branch (or tag) in repository to checkout (defaults to value of BRANCH env variable or `master') -# -d <dir> directory to copy build artifacts (default is ./dist) - -export GITREPO="${GITREPO:-https://github.com/Comcast/traffic_control}" -export BRANCH="${BRANCH:-master}" - -Usage() { - echo "Usage:" - echo " $0 [<option>...] [<project name>...]" - echo " One of -a or list of projects must be provided." - echo " Options:" - echo " -a build all subprojects" - echo " -h show usage" - echo " -r <repository path>: repository (local directory or https) to clone from" - echo " -b <branch name>: branch within repository" - echo "" -} - -while getopts :hacr:b:d: opt -do - case $opt in - h) Usage - exit 1; - ;; - a) buildall=1 - ;; - r) - GITREPO="$OPTARG" - ;; - b) - BRANCH="$OPTARG" - ;; - *) - echo "Invalid option: $opt" - Usage - exit 1; - ;; - esac -done -shift $((OPTIND-1)) - -# anything remaining is list of projects to build -if [[ -n $buildall ]] -then - projects="traffic_ops traffic_monitor traffic_router traffic_stats traffic_portal" -else - projects="$@" -fi - -if [[ -z $projects ]] -then - echo "One of -a or list of project names must be provided" - Usage - exit 1 -fi - - -# if repo is local directory, get absolute path -if [[ -d $GITREPO ]] -then - GITREPO=$(cd $GITREPO && pwd) -fi - -DIR="$( cd "$(dirname $( dirname "${BASH_SOURCE[0]}" ))" && pwd )" - -cd $DIR/infrastructure/docker/build -dist=$(pwd)/artifacts - -cat <<-ENDMSG - ******************************************************** - - Building from git repository '$GITREPO' branch '$BRANCH' - Artifacts will be delivered to '$dist' - - Projects to build: $projects - ******************************************************** - -ENDMSG - -# GITREPO and BRANCH are exported, so this will pick them up.. -docker-compose up - -echo "rpms created in $dist: " -ls -l "$dist/."
