| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2020 ETSI |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | TOPDIR=$(shell readlink -f .|sed -e 's/\/docker\/.*//') |
| 17 | MKINCLUDE=$(TOPDIR)/docker/mk |
| 18 | MKBUILD=$(TOPDIR)/docker/build |
| 19 | |
| 20 | all: build |
| 21 | |
| 22 | TAG ?= 6 |
| 23 | |
| 24 | REPOSITORY_BASE ?= http://osm-download.etsi.org/repository/osm/debian |
| 25 | RELEASE ?= ReleaseNINE-daily |
| 26 | REPOSITORY_KEY ?= OSM%20ETSI%20Release%20Key.gpg |
| 27 | REPOSITORY ?= testing |
| 28 | NO_CACHE ?= --no-cache |
| 29 | DOCKER_REGISTRY ?= "" |
| 30 | |
| 31 | LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]') |
| 32 | |
| 33 | CONTAINER_NAME ?= $(LOWER_MDG) |
| 34 | |
| 35 | CMD_DOCKER_ARGS ?= -q |
| 36 | DOCKER_ARGS = $(CMD_DOCKER_ARGS) |
| 37 | |
| 38 | DEPS := MON IM LCM RO common osmclient devops NBI policy-module Keystone N2VC lightui ngui PLA tests Prometheus |
| 39 | |
| 40 | DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS)) |
| 41 | |
| 42 | Q=@ |
| 43 | |
| 44 | $(MKBUILD): |
| 45 | $Qmkdir -p $(MKBUILD) |
| 46 | |
| 47 | $(MKBUILD)/.dep_policy-module: |
| 48 | $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m POL -p policy-module > $@ |
| 49 | |
| 50 | $(MKBUILD)/.dep_lightui: |
| 51 | $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m LW-UI -p lightui > $@ |
| 52 | |
| 53 | $(MKBUILD)/.dep_ngui: |
| 54 | $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m NG-UI -p ngui > $@ |
| 55 | |
| 56 | $(MKBUILD)/.dep_%: |
| 57 | $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m $* > $@ |
| 58 | |
| 59 | build: $(MKBUILD) $(DEPS_TARGETS) |
| 60 | $Qdocker build -t opensourcemano/$(LOWER_MDG):$(TAG) \ |
| 61 | --build-arg RELEASE=$(RELEASE) \ |
| 62 | --build-arg REPOSITORY=$(REPOSITORY) \ |
| 63 | --build-arg REPOSITORY_KEY=$(REPOSITORY_KEY) \ |
| 64 | --build-arg REPOSITORY_BASE=$(REPOSITORY_BASE) \ |
| 65 | --build-arg MON_VERSION==$(shell cat $(MKBUILD)/.dep_MON) \ |
| 66 | --build-arg IM_VERSION==$(shell cat $(MKBUILD)/.dep_IM) \ |
| 67 | --build-arg RO_VERSION==$(shell cat $(MKBUILD)/.dep_RO) \ |
| 68 | --build-arg LCM_VERSION==$(shell cat $(MKBUILD)/.dep_LCM) \ |
| 69 | --build-arg COMMON_VERSION==$(shell cat $(MKBUILD)/.dep_common) \ |
| 70 | --build-arg OSMCLIENT_VERSION==$(shell cat $(MKBUILD)/.dep_osmclient) \ |
| 71 | --build-arg NBI_VERSION==$(shell cat $(MKBUILD)/.dep_NBI) \ |
| 72 | --build-arg POL_VERSION==$(shell cat $(MKBUILD)/.dep_policy-module) \ |
| 73 | --build-arg PLA_VERSION==$(shell cat $(MKBUILD)/.dep_PLA) \ |
| 74 | --build-arg DEVOPS_VERSION==$(shell cat $(MKBUILD)/.dep_devops) \ |
| 75 | --build-arg N2VC_VERSION==$(shell cat $(MKBUILD)/.dep_N2VC) \ |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 76 | --build-arg NGUI_VERSION==$(shell cat $(MKBUILD)/.dep_ngui) \ |
| garciadeblas | 0cdfb57 | 2022-11-11 10:24:51 +0100 | [diff] [blame^] | 77 | --build-arg NGSA_VERSION==$(shell cat $(MKBUILD)/.dep_ngsa) \ |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 78 | --build-arg TESTS_VERSION==$(shell cat $(MKBUILD)/.dep_tests) \ |
| 79 | --build-arg CACHE_DATE==$(shell date -uI) \ |
| 80 | $(DOCKER_ARGS) . |
| 81 | |
| 82 | clean: |
| 83 | rm -f $(MKBUILD)/.dep* |
| 84 | |
| 85 | tag: |
| 86 | docker tag opensourcemano/$(CONTAINER_NAME):$(INPUT_TAG) $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG) |
| 87 | |
| 88 | push: tag |
| 89 | docker push $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG) |