Makefiles: Don't tag images with versions by default

Tagging each build with a version means we have to clean up lots of
images manually.  Let's change this to:
* "make build" aka "make docker-build" only builds as $name:latest
* "make docker-tag" will tag $name:latest as $name:$version

This is racey, but then we don't really need version tags for the images
so far anyway.
This commit is contained in:
Harald Welte 2017-10-15 14:45:03 +00:00
parent f81dfad75f
commit 6bce1e644f
1 changed files with 7 additions and 5 deletions

View File

@ -40,15 +40,17 @@ post-push:
docker-build: .release
docker build -t $(IMAGE):$(VERSION) .
docker build -t $(IMAGE):latest .
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \
docker-tag: docker-build
if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \
echo docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
echo docker tag -f $(IMAGE):latest $(IMAGE):$(VERSION) ;\
docker tag -f $(IMAGE):latest $(IMAGE):$(VERSION) ;\
else \
echo docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \
echo docker tag $(IMAGE):latest $(IMAGE):$(VERSION) ;\
docker tag $(IMAGE):latest $(IMAGE):$(VERSION) ; \
fi
.release: