diff --git a/.gitignore b/.gitignore index 6c9406ebc5..609b440fb3 100644 --- a/.gitignore +++ b/.gitignore @@ -39,9 +39,10 @@ prog/netcheck/netcheck tools/bin tools/build releases +.weaver.uptodate +.weavedns.uptodate +.weaveexec.uptodate weave.tar -weavedns.tar -weaveexec.tar prog/weaveexec/weave prog/weaveexec/weaveproxy prog/weaveexec/weavewait diff --git a/Makefile b/Makefile index bfd649ee1e..5031dede15 100644 --- a/Makefile +++ b/Makefile @@ -18,23 +18,25 @@ NETCHECK_EXE=prog/netcheck/netcheck EXES=$(WEAVER_EXE) $(WEAVEDNS_EXE) $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(NETCHECK_EXE) +WEAVER_UPTODATE=.weaver.uptodate +WEAVEDNS_UPTODATE=.weavedns.uptodate +WEAVEEXEC_UPTODATE=.weaveexec.uptodate + +IMAGES_UPTODATE=$(WEAVER_UPTODATE) $(WEAVEDNS_UPTODATE) $(WEAVEEXEC_UPTODATE) + WEAVER_IMAGE=$(DOCKERHUB_USER)/weave WEAVEDNS_IMAGE=$(DOCKERHUB_USER)/weavedns WEAVEEXEC_IMAGE=$(DOCKERHUB_USER)/weaveexec IMAGES=$(WEAVER_IMAGE) $(WEAVEDNS_IMAGE) $(WEAVEEXEC_IMAGE) -WEAVER_EXPORT=weave.tar -WEAVEDNS_EXPORT=weavedns.tar -WEAVEEXEC_EXPORT=weaveexec.tar - -EXPORTS=$(WEAVER_EXPORT) $(WEAVEDNS_EXPORT) $(WEAVEEXEC_EXPORT) +WEAVE_EXPORT=weave.tar WEAVEEXEC_DOCKER_VERSION=1.3.1 DOCKER_DISTRIB=prog/weaveexec/docker-$(WEAVEEXEC_DOCKER_VERSION).tgz DOCKER_DISTRIB_URL=https://get.docker.com/builds/Linux/x86_64/docker-$(WEAVEEXEC_DOCKER_VERSION).tgz -all: $(EXPORTS) +all: $(WEAVE_EXPORT) travis: $(EXES) @@ -66,15 +68,15 @@ $(SIGPROXY_EXE): prog/sigproxy/main.go $(WEAVEWAIT_EXE): prog/weavewait/main.go go build -o $@ ./$(@D) -$(WEAVER_EXPORT): prog/weaver/Dockerfile $(WEAVER_EXE) +$(WEAVER_UPTODATE): prog/weaver/Dockerfile $(WEAVER_EXE) $(SUDO) docker build -t $(WEAVER_IMAGE) prog/weaver - $(SUDO) docker save $(WEAVER_IMAGE):latest > $@ + touch $@ -$(WEAVEDNS_EXPORT): prog/weavedns/Dockerfile $(WEAVEDNS_EXE) +$(WEAVEDNS_UPTODATE): prog/weavedns/Dockerfile $(WEAVEDNS_EXE) $(SUDO) docker build -t $(WEAVEDNS_IMAGE) prog/weavedns - $(SUDO) docker save $(WEAVEDNS_IMAGE):latest > $@ + touch $@ -$(WEAVEEXEC_EXPORT): prog/weaveexec/Dockerfile $(DOCKER_DISTRIB) weave $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(NETCHECK_EXE) +$(WEAVEEXEC_UPTODATE): prog/weaveexec/Dockerfile $(DOCKER_DISTRIB) weave $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(NETCHECK_EXE) cp weave prog/weaveexec/weave cp $(SIGPROXY_EXE) prog/weaveexec/sigproxy cp $(WEAVEPROXY_EXE) prog/weaveexec/weaveproxy @@ -82,7 +84,10 @@ $(WEAVEEXEC_EXPORT): prog/weaveexec/Dockerfile $(DOCKER_DISTRIB) weave $(SIGPROX cp $(NETCHECK_EXE) prog/weaveexec/netcheck cp $(DOCKER_DISTRIB) prog/weaveexec/docker.tgz $(SUDO) docker build -t $(WEAVEEXEC_IMAGE) prog/weaveexec - $(SUDO) docker save $(WEAVEEXEC_IMAGE):latest > $@ + touch $@ + +$(WEAVE_EXPORT): $(IMAGES_UPTODATE) + $(SUDO) docker save $(addsuffix :latest,$(IMAGES)) > $@ $(DOCKER_DISTRIB): curl -o $(DOCKER_DISTRIB) $(DOCKER_DISTRIB_URL) @@ -112,7 +117,7 @@ publish: $(PUBLISH) clean: -$(SUDO) docker rmi $(IMAGES) - rm -f $(EXES) $(EXPORTS) + rm -f $(EXES) $(IMAGES_UPTODATE) $(WEAVE_EXPORT) rm -f test/tls/*.pem build: diff --git a/build/Dockerfile b/build/Dockerfile index 562673c855..23861bdfcd 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,6 +1,9 @@ FROM ubuntu -RUN apt-get -y update && apt-get -y install --no-install-recommends build-essential git ca-certificates docker.io mercurial libpcap-dev curl make pkg-config gcc bison flex +RUN apt-get -y update && apt-get -y install --no-install-recommends ca-certificates apt-transport-https +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 +RUN echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list +RUN apt-get -y update && apt-get -y install --no-install-recommends build-essential git lxc-docker-1.3.1 mercurial libpcap-dev curl make pkg-config gcc bison flex # When doing a build in a container, "apt-get update" happens twice, # which can be a very significant overhead for incremental builds. diff --git a/site/building.md b/site/building.md index 04b998ab49..4b91d59f79 100644 --- a/site/building.md +++ b/site/building.md @@ -57,8 +57,7 @@ $ make This will build the weave components and package them into three Docker images (`weaveworks/weave`, `weaveworks/weavedns`, and -`weaveworks/weaveexec`). These are then exported (as `weave.tar`, -`weavedns.tar` and `weaveexec.tar`). +`weaveworks/weaveexec`). These are then exported as `weave.tar`. ## Building in a Docker container @@ -171,15 +170,13 @@ you can do so with $ vagrant ssh -c 'make -C src/github.com/weaveworks/weave' ``` -you should then find container snapshot tarballs in the top-level -directory. You can use these snapshots with `docker load` against a -different host, e.g. +you should then find a `weave.tar` container snapshot tarball in the +top-level directory. You can use that snapshot with `docker load` +against a different host, e.g. ```bash $ export DOCKER_HOST=tcp:// $ docker load < weave.tar -$ docker load < weavedns.tar -$ docker load < weaveexec.tar ``` You can provide extra Vagrant configuration by putting a file diff --git a/test/setup.sh b/test/setup.sh index d2b49f0175..7235b4a485 100755 --- a/test/setup.sh +++ b/test/setup.sh @@ -10,8 +10,6 @@ echo "Copying weave images, scripts, and certificates to hosts, and" echo " prefetch test images" for HOST in $HOSTS; do docker_on $HOST load -i ../weave.tar - docker_on $HOST load -i ../weavedns.tar - docker_on $HOST load -i ../weaveexec.tar run_on $HOST mkdir -p bin cat ../bin/docker-ns | run_on $HOST sh -c "cat > $DOCKER_NS" cat ../weave | run_on $HOST sh -c "cat > ./weave"