Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License.d |
| 16 | # ----------------------------------------------------------------------- |
| 17 | |
| 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
| 20 | ## Docker related -- are these ${shell vars} or $(make macros) ? |
| 21 | DOCKER_TAG ?= ${VERSION} |
| 22 | DOCKER_REPOSITORY ?= |
| 23 | DOCKER_REGISTRY ?= |
| 24 | DOCKER_RUN_ARGS ?= |
| 25 | DOCKER_PORTS ?= -p 50070:50070 -p 50060:50060 -p 50071:50071 -p 50072:50072 -p 50073:50073 -p 50074:50074 -p 50075:50075 |
| 26 | TYPE ?= minimal |
| 27 | |
| 28 | # tool containers |
| 29 | VOLTHA_TOOLS_VERSION ?= 2.3.1 |
| 30 | |
| 31 | docker-run = docker run --rm --user $$(id -u):$$(id -g)# # Docker command stem |
| 32 | docker-run-app = $(docker-run) -v ${CURDIR}:/app# # w/filesystem mount |
Joey Armstrong | b98dfe8 | 2023-05-16 16:34:34 -0400 | [diff] [blame] | 33 | |
| 34 | ## ----------------------------------------------------------------------- |
| 35 | ## --interactive: Attach streams if running interactively (!jenkins) |
| 36 | ## --tty : Attach stdout else jenkins::docker is silent. |
| 37 | ## ----------------------------------------------------------------------- |
Joey Armstrong | f99712c | 2023-06-01 17:04:38 -0400 | [diff] [blame] | 38 | is-stdin = $(shell test -t 0 && { echo '--interactive'; }) |
Joey Armstrong | b98dfe8 | 2023-05-16 16:34:34 -0400 | [diff] [blame] | 39 | is-stdin += --tty |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 40 | |
| 41 | # Docker volume mounts: container:/app/release <=> localhost:{pwd}/release |
| 42 | vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg |
| 43 | vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION} |
| 44 | |
| 45 | GO = $(docker-run-app) $(is-stdin) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang go |
| 46 | GO_SH = $(docker-run-app) $(is-stdin) --env-file ./foobar -v gocache:/.cache $(vee-golang) $(vee-citools)-golang sh -c |
| 47 | GO_JUNIT_REPORT = $(docker-run-app) -i $(vee-citools)-go-junit-report go-junit-report |
| 48 | GOCOVER_COBERTURA = $(docker-run) -v ${CURDIR}:/app/src/github.com/opencord/bbsim -i $(vee-citools)-gocover-cobertura gocover-cobertura |
| 49 | GOLANGCI_LINT = $(docker-run-app) $(is-stdin) -v gocache:/.cache $(vee-golang) $(vee-citools)-golangci-lint golangci-lint |
| 50 | PROTOC = $(docker-run-app) $(is-stdin) $(vee-golang) $(vee-citools)-protoc protoc |
| 51 | |
| 52 | $(if $(DEBUG),$(warning LEAVE)) |
| 53 | |
| 54 | # [EOF] |