khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | ifeq ($(TAG),) |
| 18 | TAG := latest |
| 19 | endif |
| 20 | |
| 21 | ifeq ($(TARGET_TAG),) |
| 22 | TARGET_TAG := latest |
| 23 | endif |
| 24 | |
| 25 | # If no DOCKER_HOST_IP is specified grab a v4 IP address associated with |
| 26 | # the default gateway |
| 27 | ifeq ($(DOCKER_HOST_IP),) |
| 28 | DOCKER_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') |
| 29 | endif |
| 30 | |
| 31 | |
| 32 | ifneq ($(http_proxy)$(https_proxy),) |
| 33 | # Include proxies from the environment |
| 34 | DOCKER_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) |
| 43 | endif |
| 44 | |
| 45 | DOCKER_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 | |
| 53 | DOCKER_IMAGE_LIST = \ |
| 54 | rw_core |
| 55 | |
| 56 | |
Stephane Barbarie | a75791c | 2019-01-24 10:58:06 -0500 | [diff] [blame] | 57 | .PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) rw_core ro_core protos kafka db tests python simulators k8s afrouter arouterd base |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 58 | |
| 59 | # This should to be the first and default target in this Makefile |
| 60 | help: |
| 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" |
Stephane Barbarie | a75791c | 2019-01-24 10:58:06 -0500 | [diff] [blame] | 67 | @echo "ro_core : Build the ro_core docker container" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 68 | @echo |
| 69 | |
| 70 | |
| 71 | # Parallel Build |
| 72 | $(DIRS): |
| 73 | @echo " MK $@" |
| 74 | $(Q)$(MAKE) -C $@ |
| 75 | |
| 76 | # Parallel Clean |
| 77 | DIRS_CLEAN = $(addsuffix .clean,$(DIRS)) |
| 78 | $(DIRS_CLEAN): |
| 79 | @echo " CLEAN $(basename $@)" |
| 80 | $(Q)$(MAKE) -C $(basename $@) clean |
| 81 | |
khenaidoo | 9a46896 | 2018-09-19 15:33:13 -0400 | [diff] [blame] | 82 | build: containers |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 83 | |
Stephane Barbarie | a75791c | 2019-01-24 10:58:06 -0500 | [diff] [blame] | 84 | containers: base rw_core ro_core simulated_olt simulated_onu afrouter arouterd |
sslobodr | 2fb98b8 | 2019-01-21 09:29:51 -0500 | [diff] [blame] | 85 | |
| 86 | base: |
William Kurkian | daa6bb2 | 2019-03-07 12:26:28 -0500 | [diff] [blame^] | 87 | ifdef LOCAL_PROTOS |
| 88 | mkdir -p vendor/github.com/opencord/voltha-protos/go |
| 89 | cp -r ${GOPATH}/src/github.com/opencord/voltha-protos/go/ vendor/github.com/opencord/voltha-protos |
| 90 | endif |
sslobodr | 2fb98b8 | 2019-01-21 09:29:51 -0500 | [diff] [blame] | 91 | docker build $(DOCKER_BUILD_ARGS) -t base:latest -f docker/Dockerfile.base . |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 92 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 93 | afrouter: |
sslobodr | 38afd0d | 2019-01-21 12:31:46 -0500 | [diff] [blame] | 94 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}afrouter:${TAG} -f docker/Dockerfile.arouter . |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 95 | |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 96 | afrouterTest: |
| 97 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}afroutertest:${TAG} -f docker/Dockerfile.arouterTest . |
| 98 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 99 | arouterd: |
sslobodr | 38afd0d | 2019-01-21 12:31:46 -0500 | [diff] [blame] | 100 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}afrouterd:${TAG} -f docker/Dockerfile.arouterd . |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 101 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 102 | rw_core: |
| 103 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-rw-core:${TAG} -f docker/Dockerfile.rw_core . |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 104 | |
Stephane Barbarie | a75791c | 2019-01-24 10:58:06 -0500 | [diff] [blame] | 105 | ro_core: |
| 106 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-ro-core:${TAG} -f docker/Dockerfile.ro_core . |
| 107 | |
khenaidoo | d2b6df9 | 2018-12-13 16:37:20 -0500 | [diff] [blame] | 108 | simulated_olt: |
| 109 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-simulated-olt:${TAG} -f docker/Dockerfile.simulated_olt . |
khenaidoo | d2b6df9 | 2018-12-13 16:37:20 -0500 | [diff] [blame] | 110 | |
khenaidoo | d2b6df9 | 2018-12-13 16:37:20 -0500 | [diff] [blame] | 111 | simulated_onu: |
| 112 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-simulated-onu:${TAG} -f docker/Dockerfile.simulated_onu . |
khenaidoo | d2b6df9 | 2018-12-13 16:37:20 -0500 | [diff] [blame] | 113 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 114 | # end file |