Skip to content

Commit

Permalink
Rework Makefile targets
Browse files Browse the repository at this point in the history
`make docker` is now `make local`, and builds for local dev.

`make docker push` is now `make release`; it requires a VERSION in the
environment, and it builds, tags, and pushed imges.
  • Loading branch information
jhunt committed Aug 9, 2020
1 parent 7d9bbe6 commit f477ae7
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
VERSION := 1.3
CPPFLAGS += -DVERSION=\"$(VERSION)\"

default: netip
all: netip fuzzy tester

docker:
local:
docker build \
--build-arg VERSION="$(VERSION)" \
--build-arg BUILD_DATE="$(shell date -u --iso-8601)" \
--build-arg VCS_REF="$(shell git rev-parse --short HEAD)" \
. -t huntprod/netip.cc:latest

docker build -f Dockerfile.web \
--build-arg VERSION="$(VERSION)" \
--build-arg BUILD_DATE="$(shell date -u --iso-8601)" \
--build-arg VCS_REF="$(shell git rev-parse --short HEAD)" \
. -t huntprod/www.netip.cc:latest

push:
release:
@echo "Checking that VERSION was defined in the calling environment"
@test -n "$(VERSION)"
@echo "OK. VERSION=$(VERSION)"
docker build \
--build-arg VERSION="$(VERSION)" \
--build-arg BUILD_DATE="$(shell date -u --iso-8601)" \
--build-arg VCS_REF="$(shell git rev-parse --short HEAD)" \
. -t huntprod/netip.cc:latest

docker tag huntprod/netip.cc:latest huntprod/netip.cc:$(VERSION)
docker push huntprod/netip.cc:latest
docker push huntprod/netip.cc:$(VERSION)

docker build -f Dockerfile.web \
--build-arg VERSION="$(VERSION)" \
--build-arg BUILD_DATE="$(shell date -u --iso-8601)" \
--build-arg VCS_REF="$(shell git rev-parse --short HEAD)" \
. -t huntprod/www.netip.cc:latest

docker tag huntprod/www.netip.cc:latest huntprod/www.netip.cc:$(VERSION)
docker push huntprod/www.netip.cc:latest
docker push huntprod/www.netip.cc:$(VERSION)
Expand Down

0 comments on commit f477ae7

Please sign in to comment.