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)") |
Andy Bavier | 67282ee | 2017-08-16 16:37:24 -0700 | [diff] [blame] | 12 | include $(MAKE_CONFIG) |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 13 | endif |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 14 | |
| 15 | .PHONY: all |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 16 | all: build |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 17 | |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 18 | .PHONY: build |
| 19 | build: |
| 20 | docker build -f Dockerfile.make -t $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) $(ROOT_DIR) |
| 21 | |
David K. Bainbridge | 56da957 | 2017-08-17 09:56:50 -0700 | [diff] [blame] | 22 | .PHONY: onos |
| 23 | onos: |
| 24 | docker build -t cord/onos:latest -f docker/Dockerfile.onos . |
| 25 | |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 26 | .PHONY: publish |
| 27 | publish: |
| 28 | docker tag $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) |
| 29 | docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 30 | |
| 31 | .PHONY: clean |
| 32 | clean: |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 33 | docker rmi $(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) | true |
| 34 | docker rmi $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(DEPLOY_DOCKER_TAG) | true |
Andy Bavier | 25ebf0e | 2017-06-06 18:27:15 -0400 | [diff] [blame] | 35 | |
| 36 | .PHONY: test |
| 37 | test: |
| 38 | @echo "No unit tests at present" |
| 39 | |
| 40 | .PHONY: help |
| 41 | help: |
| 42 | @echo "Available targets:" |
Andy Bavier | 1fd3917 | 2017-07-20 15:54:11 -0700 | [diff] [blame] | 43 | @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] | 44 | @echo " clean: remove the Docker image" |
| 45 | @echo " test: run unit tests" |
| 46 | @echo " help: print this help message" |
| 47 | |