Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 1 | ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) |
| 2 | |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame^] | 3 | IMAGE_NAME ?= opencord/mavenrepo |
| 4 | DOCKER_REGISTRY ?= docker-registry:5000 |
| 5 | DEPLOY_DOCKER_TAG ?= candidate |
| 6 | |
| 7 | MAKE_CONFIG ?= config.mk |
| 8 | ifeq ($(realpath $(MAKE_CONFIG)),) |
| 9 | $(info Makefile configuration not found, defaults will be used.) |
| 10 | else |
| 11 | $(info Using makefile configuration "$(MAKE_CONFIG)") |
| 12 | endif |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 13 | |
| 14 | .PHONY: all |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame^] | 15 | all: build |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 16 | |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame^] | 17 | .PHONY: build |
| 18 | build: |
| 19 | docker build -f Dockerfile.make -t $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) $(ROOT_DIR) |
| 20 | |
| 21 | .PHONY: publish |
| 22 | publish: |
| 23 | docker tag $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) |
| 24 | docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 25 | |
| 26 | .PHONY: clean |
| 27 | clean: |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame^] | 28 | docker rmi $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) | true |
| 29 | docker rmi $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) | true |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 30 | |
| 31 | .PHONY: test |
| 32 | test: |
| 33 | @echo "No unit tests at present" |
| 34 | |
| 35 | .PHONY: help |
| 36 | help: |
| 37 | @echo "Available targets:" |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame^] | 38 | @echo " build: build the Docker image (Maven repo with the CORD ONOS apps)" |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 39 | @echo " clean: remove the Docker image" |
| 40 | @echo " test: run unit tests" |
| 41 | @echo " help: print this help message" |
| 42 | |