wire in weavetools image build

We use a plain ubuntu container as a build environment for ethtool &
conntrack, so a) we don't require onerous tooling on the build host,
and b) don't pollute the build host with build artefacts. The latter
arise because I can only get conntrack to build by installing its
dependencies 'globally'.

Th dir containing the build script is volume-mounted into the
container, and that is where we also expect to see the result, namely
a 'bin' sub-dir containing two executables.

The weavetools image is then constructed from the 'scratch' image and
contains just that dir.
This commit is contained in:
Matthias Radestock committed 2015-01-01 00:57:02 +00:00
1 parent dd34099e06
commit 7b6ea37fea
1 file changed
+14 -3
+14 -3
View File
@@ -7,12 +7,15 @@ SUDO=sudo
WEAVE_VERSION=git-$(shell git rev-parse --short=12 HEAD)
WEAVER_EXE=weaver/weaver
WEAVEDNS_EXE=weavedns/weavedns
WEAVETOOLS_EXES=tools/bin
WEAVER_IMAGE=zettio/weave
WEAVEDNS_IMAGE=zettio/weavedns
WEAVETOOLS_IMAGE=zettio/weavetools
WEAVER_EXPORT=/var/tmp/weave.tar
WEAVEDNS_EXPORT=/var/tmp/weavedns.tar
WEAVETOOLS_EXPORT=/var/tmp/weavetools.tar
all: $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT)
all: $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT) $(WEAVETOOLS_EXPORT)
$(WEAVER_EXE) $(WEAVEDNS_EXE):
go get -tags netgo ./$(shell dirname $@)
@@ -29,6 +32,9 @@ $(WEAVER_EXE) $(WEAVEDNS_EXE):
$(WEAVER_EXE): router/*.go weaver/main.go
$(WEAVEDNS_EXE): nameserver/*.go weavedns/main.go
$(WEAVETOOLS_EXES): tools/build.sh
$(SUDO) docker run --rm -v $(realpath $(<D)):/home/weave ubuntu sh /home/weave/build.sh
$(WEAVER_EXPORT): weaver/Dockerfile $(WEAVER_EXE)
$(SUDO) docker build -t $(WEAVER_IMAGE) weaver
$(SUDO) docker save $(WEAVER_IMAGE):latest > $@
@@ -37,10 +43,15 @@ $(WEAVEDNS_EXPORT): weavedns/Dockerfile $(WEAVEDNS_EXE)
$(SUDO) docker build -t $(WEAVEDNS_IMAGE) weavedns
$(SUDO) docker save $(WEAVEDNS_IMAGE):latest > $@
$(WEAVETOOLS_EXPORT): tools/Dockerfile $(WEAVETOOLS_EXES)
$(SUDO) docker build -t $(WEAVETOOLS_IMAGE) tools
$(SUDO) docker save $(WEAVETOOLS_IMAGE):latest > $@
# Add more directories in here as more tests are created
tests:
cd nameserver; go test -tags netgo
clean:
-$(SUDO) docker rmi $(WEAVER_IMAGE) $(WEAVEDNS_IMAGE)
rm -f $(WEAVER_EXE) $(WEAVEDNS_EXE) $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT)
-$(SUDO) docker rmi $(WEAVER_IMAGE) $(WEAVEDNS_IMAGE) $(WEAVETOOLS_IMAGE)
rm -f $(WEAVER_EXE) $(WEAVEDNS_EXE) $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT) $(WEAVETOOLS_EXPORT)
$(SUDO) rm -rf $(WEAVETOOLS_EXES)