Correcting Syntax for Docker
[osm/devops.git] / docker / mk / Makefile.include
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         ?= ReleaseEIGHT-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
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) \
76                    --build-arg LWUI_VERSION==$(shell cat $(MKBUILD)/.dep_lightui) \
77                    --build-arg NGUI_VERSION==$(shell cat $(MKBUILD)/.dep_ngui) \
78                    --build-arg TESTS_VERSION==$(shell cat $(MKBUILD)/.dep_tests) \
79                    $(DOCKER_ARGS) .
80
81 clean:
82         rm -f $(MKBUILD)/.dep*
83
84 tag:
85         docker tag opensourcemano/$(CONTAINER_NAME):$(INPUT_TAG) $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG)
86
87 push: tag
88         docker push $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG)