You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2016/11/14 17:07:36 UTC

[33/53] [abbrv] incubator-trafficcontrol git commit: build traffic_ops from docker-compose

build traffic_ops from docker-compose


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/29ba3b8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/29ba3b8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/29ba3b8f

Branch: refs/heads/psql-rebase
Commit: 29ba3b8f14ef164a19e58a86641b3f4bb6bdd174
Parents: 189fb1e
Author: Dan Kirkwood <da...@gmail.com>
Authored: Fri Sep 30 14:02:26 2016 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Fri Nov 11 14:06:38 2016 -0700

----------------------------------------------------------------------
 build/Dockerfile-clone       | 19 +++++++++++++++++++
 build/Dockerfile-traffic_ops | 32 ++++++++++++++------------------
 build/docker-compose.yml     | 20 ++++++++++++++++----
 3 files changed, 49 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/29ba3b8f/build/Dockerfile-clone
----------------------------------------------------------------------
diff --git a/build/Dockerfile-clone b/build/Dockerfile-clone
new file mode 100644
index 0000000..6f5e040
--- /dev/null
+++ b/build/Dockerfile-clone
@@ -0,0 +1,19 @@
+FROM centos:7
+
+MAINTAINER Dan Kirkwood
+
+RUN	yum -y install \
+		epel-release \
+		git \
+		golang  \
+		rpm-build && \
+	yum -y clean all
+
+ENV GITREPO=https://github.com/Comcast/traffic_control
+ENV BRANCH=master
+
+WORKDIR /repo
+RUN echo $'pwd; git clone $GITREPO -b $BRANCH traffic_control\n\
+' >/run.sh
+
+CMD sh -x /run.sh

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/29ba3b8f/build/Dockerfile-traffic_ops
----------------------------------------------------------------------
diff --git a/build/Dockerfile-traffic_ops b/build/Dockerfile-traffic_ops
index 0072a1a..0f0cddc 100644
--- a/build/Dockerfile-traffic_ops
+++ b/build/Dockerfile-traffic_ops
@@ -5,24 +5,20 @@ MAINTAINER Dan Kirkwood
 RUN	yum -y install \
 		epel-release \
 		git \
-		rpm-build
-
-ENV GITREPO=https://github.com/Comcast/traffic_control
-ENV BRANCH=master
-
-RUN set -x && git clone $GITREPO traffic_control
-WORKDIR /traffic_control
-RUN git fetch && git checkout $BRANCH && git pull origin $BRANCH
-
-#############################################################################
-# Above are common for all sub-projects.
-
-RUN	yum -y install \
-		golang && \
+		golang  \
+		rpm-build && \
 	yum -y clean all
 
-RUN	mkdir -p /dist
-VOLUME	/dist
+# wait for clone to be available, then
+# build the rpm and copy to /artifacts
+
+RUN echo $'\n\
+tc=/repo/traffic_control\n\
+while [ ! -d $tc/traffic_ops ]; do sleep 1; done\n\
+cd $tc/traffic_ops\n\
+./build/build_rpm.sh\n\
+mkdir -p /artifacts\n\
+cp $tc/dist/* /artifacts/.\n\
+' >/run.sh
 
-WORKDIR /traffic_control/traffic_ops
-CMD ./build/build_rpm.sh
+CMD sh -x /run.sh

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/29ba3b8f/build/docker-compose.yml
----------------------------------------------------------------------
diff --git a/build/docker-compose.yml b/build/docker-compose.yml
index 1f2d709..6697a81 100644
--- a/build/docker-compose.yml
+++ b/build/docker-compose.yml
@@ -4,15 +4,27 @@
 version: '2'
 
 volumes:
-  traffic_control:
+  repo:
 
 services:
-  traffic_ops:
+  clone:
     build:
-      dockerfile: Dockerfile-traffic_ops
+      dockerfile: Dockerfile-clone
       context: .
     environment:
+      - GITREPO
       - BRANCH
     volumes:
-      - traffic_control:/traffic_control
+      - repo:/repo
 
+  traffic_ops_build:
+    depends_on: [ clone ]
+    build:
+      dockerfile: Dockerfile-traffic_ops
+      context: .
+    environment:
+      - GITREPO
+      - BRANCH
+    volumes:
+      - repo:/repo
+      - ./artifacts:/artifacts