blob: 1fd6dcd98953d543171fcbe5a738aa227337004f [file] [log] [blame]
bravofc973b572020-10-21 16:58:50 -03001#
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#
16TOPDIR=$(shell readlink -f .|sed -e 's/\/docker\/.*//')
17MKINCLUDE=$(TOPDIR)/docker/mk
18MKBUILD=$(TOPDIR)/docker/build
19
20all: build
21
22TAG ?= 6
23
24REPOSITORY_BASE ?= http://osm-download.etsi.org/repository/osm/debian
25RELEASE ?= ReleaseNINE-daily
26REPOSITORY_KEY ?= OSM%20ETSI%20Release%20Key.gpg
27REPOSITORY ?= testing
28NO_CACHE ?= --no-cache
29DOCKER_REGISTRY ?= ""
30
31LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]')
32
33CONTAINER_NAME ?= $(LOWER_MDG)
34
35CMD_DOCKER_ARGS ?= -q
36DOCKER_ARGS = $(CMD_DOCKER_ARGS)
37
38DEPS := MON IM LCM RO common osmclient devops NBI policy-module Keystone N2VC lightui ngui PLA tests Prometheus
39
40DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS))
41
42Q=@
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
59build: $(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) \
bravofc973b572020-10-21 16:58:50 -030076 --build-arg NGUI_VERSION==$(shell cat $(MKBUILD)/.dep_ngui) \
garciadeblas0cdfb572022-11-11 10:24:51 +010077 --build-arg NGSA_VERSION==$(shell cat $(MKBUILD)/.dep_ngsa) \
bravofc973b572020-10-21 16:58:50 -030078 --build-arg TESTS_VERSION==$(shell cat $(MKBUILD)/.dep_tests) \
79 --build-arg CACHE_DATE==$(shell date -uI) \
80 $(DOCKER_ARGS) .
81
82clean:
83 rm -f $(MKBUILD)/.dep*
84
85tag:
86 docker tag opensourcemano/$(CONTAINER_NAME):$(INPUT_TAG) $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG)
87
88push: tag
89 docker push $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG)