Browse Source

Merge pull request #144 from squaremo/create_build_image

Create build image with dependencies installed
Madhu Venugopal 10 years ago
parent
commit
c9d0e35daf
2 changed files with 19 additions and 11 deletions
  1. 2 0
      libnetwork/.gitignore
  2. 17 11
      libnetwork/Makefile

+ 2 - 0
libnetwork/.gitignore

@@ -29,3 +29,5 @@ _testmain.go
 
 # IDE files
 .project
+
+libnetwork-build.created

+ 17 - 11
libnetwork/Makefile

@@ -1,23 +1,30 @@
 .PHONY: all all-local build build-local check check-code check-format run-tests check-local install-deps coveralls circle-ci
 SHELL=/bin/bash
-dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork golang:1.4
-docker = docker run --rm ${dockerargs}
+build_image=libnetwork-build
+dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
+docker = docker run --rm ${dockerargs} ${build_image}
 ciargs = -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN"
-cidocker = docker run ${ciargs} ${dockerargs}
+cidocker = docker run ${ciargs} ${dockerargs} golang:1.4
 
-all: 
+all: ${build_image}.created
 	${docker} make all-local
 
-all-local: 	install-deps check-local build-local
+all-local: check-local build-local
 
-build: 
-	${docker} make install-deps build-local
+${build_image}.created:
+	docker run --name=libnetworkbuild -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork golang:1.4 make install-deps
+	docker commit libnetworkbuild ${build_image}
+	docker rm libnetworkbuild
+	touch ${build_image}.created
+
+build: ${build_image}.created
+	${docker} make build-local
 
 build-local:
 	$(shell which godep) go build ./...
 
-check:
-	${docker} make install-deps check-local
+check: ${build_image}.created
+	${docker} make check-local
 
 check-code:
 	@echo "Checking code... "
@@ -35,7 +42,7 @@ run-tests:
 	@echo "mode: count" > coverage.coverprofile
 	@for dir in $$(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do \
 	    if ls $$dir/*.go &> /dev/null; then \
-            	$(shell which godep) go test -test.parallel 3 -test.v -covermode=count -coverprofile=$$dir/profile.tmp $$dir ; \
+		$(shell which godep) go test -test.parallel 3 -test.v -covermode=count -coverprofile=$$dir/profile.tmp $$dir ; \
 		if [ $$? -ne 0 ]; then exit $$?; fi ;\
 	        if [ -f $$dir/profile.tmp ]; then \
 		        cat $$dir/profile.tmp | tail -n +2 >> coverage.coverprofile ; \
@@ -64,4 +71,3 @@ coveralls:
 
 circle-ci:
 	@${cidocker} make install-deps check-local coveralls
-