From 87c4fb2fea8a0ee7577e2ba1bd336160407dcd86 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Mon, 22 Dec 2014 23:48:07 -0800 Subject: [PATCH] Makefiles: build the test docker img this commit changes how the dockertest image is built. it moves the command into dockertest/Makefile. It also uses a cached file that -- if removed with make clean -- can signal whether the image should be rebuilt. (it may be ideal to have it either detect code has changed, or just rebuild every time. ) --- Makefile | 1 - dockertest/Makefile | 14 +++++++++++--- dockertest/build/.gitignore | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 634267039..79785f25e 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,6 @@ test: test_go test_sharness test_expensive: test_go_expensive test_sharness_expensive test_docker: - docker build -t zaqwsx_ipfs-test-img . cd dockertest/ && make test_go: diff --git a/dockertest/Makefile b/dockertest/Makefile index 69cc91f08..c166eea11 100644 --- a/dockertest/Makefile +++ b/dockertest/Makefile @@ -14,9 +14,6 @@ setup: docker_ipfs_image data/filetiny data/filerand save_logs: sh bin/save_logs.sh -docker_ipfs_image: - docker images | grep $(IPFS_DOCKER_IMAGE) - data/filetiny: Makefile cp Makefile ./data/filetiny # simple @@ -26,6 +23,16 @@ data/filerand: bin/random bin/random: go build -o ./bin/random ../$(RANDOMSRC) +docker_ipfs_image: build/.built_img + docker images | grep $(IPFS_DOCKER_IMAGE) + +# this is here so that "make clean; make" rebuilds the docker img. +# but otherwise will reuse whatever you last built. +# TODO: make this detect whether code has been changed +build/.built_img: + cd .. && docker build -t $(IPFS_DOCKER_IMAGE) . + touch build/.built_img + clean: sh bin/clean.sh fig stop @@ -34,3 +41,4 @@ clean: rm -f data/filetiny rm -f data/filerand rm -rf build/* + rm -rf build/.built_img diff --git a/dockertest/build/.gitignore b/dockertest/build/.gitignore index d1871380a..f8f13cfaf 100644 --- a/dockertest/build/.gitignore +++ b/dockertest/build/.gitignore @@ -1,2 +1 @@ -*.log -go-random +.built_img