Commit 82c687eb authored by Stewart Williams's avatar Stewart Williams
Browse files

Improve makefile

parent 5c9e1614
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ DOCKER_FILE_PATH=Dockerfile
.PHONY: pre-build docker-build post-build build release patch-release minor-release major-release tag check-status check-release showver \
	push pre-push do-push post-push

build: pre-build docker-build post-build
build: pre-build docker-build post-build  ## build the application image

pre-build:

@@ -68,7 +68,7 @@ docker-build: .release

release: check-status check-release build push

push: pre-push do-push post-push
push: pre-push do-push post-push  ## push the image to the Docker registry

do-push:
#	docker push $(IMAGE):$(VERSION)
+15 −15
Original line number Diff line number Diff line
DOCKER_REGISTRY_USER=ska-telescope
include .make/Makefile.mk

PROJECT = ska-skeleton
@@ -11,11 +12,7 @@ DOCKER_RUN_ARGS =
# defines the image to test
IMAGE_TO_TEST = $(DOCKER_REGISTRY_HOST)/$(DOCKER_REGISTRY_USER)/$(PROJECT):latest

DOCKER_COMPOSE_COMMAND = PWD=$(CURDIR) \
						 DOCKER_REGISTRY_HOST=$(DOCKER_REGISTRY_HOST) \
						 DOCKER_REGISTRY_USER=$(DOCKER_REGISTRY_USER) \
						 docker-compose \
						 -f docker-compose.yml
.DEFAULT_GOAL := help

# defines a function to copy the ./test-harness directory into the container
# and then runs the requested make target in the container. The container is:
@@ -35,25 +32,28 @@ make = tar -c test-harness/ | \
	   tar x --strip-components 1 --warning=all && \
	   make TANGO_HOST=databaseds:10000 $1"

all: test

test: DOCKER_RUN_ARGS = --volumes-from=$(BUILD)
test:
test:  ## test the application
	$(INIT_CACHE)
	$(DOCKER_COMPOSE_COMMAND) up -d
	docker-compose up -d
	$(call make,test); \
	  status=$$?; \
	  rm -fr build; \
	  docker cp $(BUILD):/build .; \
	  docker rm -f -v $(BUILD); \
	  $(DOCKER_COMPOSE_COMMAND) down; \
	  docker-compose down; \
	  exit $$status

devenv:
	$(INIT_CACHE)
	$(DOCKER_COMPOSE_COMMAND) up -d
up:  ## start develop/test environment
	docker-compose up -d

down:  ## stop develop/test environment
	docker-compose down

help:  ## show this help.
	@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: all test devenv
.PHONY: all test up down help

# Creates Docker volume for use as a cache, if it doesn't exist already
INIT_CACHE = \