blob: de5f790e82f629eeb6377f87f10471f010774c74 [file] [log] [blame]
khenaidoocfee5f42018-07-19 22:47:38 -04001#
2# Copyright 2016 the original author or authors.
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
17ifeq ($(TAG),)
18TAG := latest
19endif
20
21ifeq ($(TARGET_TAG),)
22TARGET_TAG := latest
23endif
24
25# If no DOCKER_HOST_IP is specified grab a v4 IP address associated with
26# the default gateway
27ifeq ($(DOCKER_HOST_IP),)
28DOCKER_HOST_IP := $(shell ifconfig $$(netstat -rn | grep -E '^(default|0.0.0.0)' | head -1 | awk '{print $$NF}') | grep inet | awk '{print $$2}' | sed -e 's/addr://g')
29endif
30
31
32ifneq ($(http_proxy)$(https_proxy),)
33# Include proxies from the environment
34DOCKER_PROXY_ARGS = \
35 --build-arg http_proxy=$(http_proxy) \
36 --build-arg https_proxy=$(https_proxy) \
37 --build-arg ftp_proxy=$(ftp_proxy) \
38 --build-arg no_proxy=$(no_proxy) \
39 --build-arg HTTP_PROXY=$(HTTP_PROXY) \
40 --build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
41 --build-arg FTP_PROXY=$(FTP_PROXY) \
42 --build-arg NO_PROXY=$(NO_PROXY)
43endif
44
45DOCKER_BUILD_ARGS = \
46 --build-arg TAG=$(TAG) \
47 --build-arg REGISTRY=$(REGISTRY) \
48 --build-arg REPOSITORY=$(REPOSITORY) \
49 $(DOCKER_PROXY_ARGS) $(DOCKER_CACHE_ARG) \
50 --rm --force-rm \
51 $(DOCKER_BUILD_EXTRA_ARGS)
52
53DOCKER_IMAGE_LIST = \
54 rw_core
55
56
sslobodra3ea7d42019-01-16 15:03:16 -050057.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) rw_core protos kafka db tests python simulators k8s afrouter arouterd
khenaidoocfee5f42018-07-19 22:47:38 -040058
59# This should to be the first and default target in this Makefile
60help:
61 @echo "Usage: make [<target>]"
62 @echo "where available targets are:"
63 @echo
64 @echo "build : Build the docker images.\n\
65 If this is the first time you are building, choose \"make build\" option."
66 @echo "rw_core : Build the rw_core docker container"
67 @echo
68
69
70# Parallel Build
71$(DIRS):
72 @echo " MK $@"
73 $(Q)$(MAKE) -C $@
74
75# Parallel Clean
76DIRS_CLEAN = $(addsuffix .clean,$(DIRS))
77$(DIRS_CLEAN):
78 @echo " CLEAN $(basename $@)"
79 $(Q)$(MAKE) -C $(basename $@) clean
80
khenaidoo9a468962018-09-19 15:33:13 -040081build: containers
khenaidoocfee5f42018-07-19 22:47:38 -040082
sslobodra3ea7d42019-01-16 15:03:16 -050083containers: rw_core simulated_olt simulated_onu afrouter arouterd
khenaidoocfee5f42018-07-19 22:47:38 -040084
sslobodra3ea7d42019-01-16 15:03:16 -050085afrouter:
86 docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}arouter:${TAG} -f docker/Dockerfile.arouter .
87
88arouterd:
89 docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}arouterd:${TAG} -f docker/Dockerfile.arouterd .
90
khenaidoocfee5f42018-07-19 22:47:38 -040091rw_core:
92 docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-rw-core:${TAG} -f docker/Dockerfile.rw_core .
khenaidoocfee5f42018-07-19 22:47:38 -040093
khenaidood2b6df92018-12-13 16:37:20 -050094simulated_olt:
95 docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-simulated-olt:${TAG} -f docker/Dockerfile.simulated_olt .
khenaidood2b6df92018-12-13 16:37:20 -050096
khenaidood2b6df92018-12-13 16:37:20 -050097simulated_onu:
98 docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-simulated-onu:${TAG} -f docker/Dockerfile.simulated_onu .
khenaidood2b6df92018-12-13 16:37:20 -050099
khenaidoocfee5f42018-07-19 22:47:38 -0400100# end file