|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. 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, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +ifneq ($(shell uname),Darwin) |
| 19 | +DOCKER_RUN_FLAGS=--user=$(shell id -u) |
| 20 | +endif |
| 21 | + |
| 22 | +ifneq ($(http_proxy),) |
| 23 | +DOCKER_BUILD_FLAGS+=--build-arg http_proxy=$(http_proxy) |
| 24 | +DOCKER_RUN_FLAGS+=-e http_proxy=$(http_proxy) |
| 25 | +endif |
| 26 | +ifneq ($(https_proxy),) |
| 27 | +DOCKER_BUILD_FLAGS+=--build-arg https_proxy=$(https_proxy) |
| 28 | +DOCKER_RUN_FLAGS+=-e https_proxy=$(https_proxy) |
| 29 | +endif |
| 30 | +ifneq ($(HTTP_PROXY),) |
| 31 | +DOCKER_BUILD_FLAGS+=--build-arg HTTP_PROXY=$(HTTP_PROXY) |
| 32 | +DOCKER_RUN_FLAGS+=-e HTTP_PROXY=$(HTTP_PROXY) |
| 33 | +endif |
| 34 | +ifneq ($(HTTPS_PROXY),) |
| 35 | +DOCKER_BUILD_FLAGS+=--build-arg HTTPS_PROXY=$(HTTPS_PROXY) |
| 36 | +DOCKER_RUN_FLAGS+=-e HTTPS_PROXY=$(HTTPS_PROXY) |
| 37 | +endif |
| 38 | +ifneq ($(no_proxy),) |
| 39 | +DOCKER_BUILD_FLAGS+=--build-arg no_proxy=$(no_proxy) |
| 40 | +DOCKER_RUN_FLAGS+=-e no_proxy=$(no_proxy) |
| 41 | +endif |
| 42 | +ifneq ($(NO_PROXY),) |
| 43 | +DOCKER_BUILD_FLAGS+=--build-arg NO_PROXY=$(NO_PROXY) |
| 44 | +DOCKER_RUN_FLAGS+=-e NO_PROXY=$(NO_PROXY) |
| 45 | +endif |
| 46 | + |
| 47 | +DRUN = docker run -i --rm $(DOCKER_RUN_FLAGS) \ |
| 48 | + -v $(abspath .):/opt/gopath/src/$(PKGNAME) \ |
| 49 | + -w /opt/gopath/src/$(PKGNAME) |
| 50 | + |
| 51 | +DBUILD = docker build $(DOCKER_BUILD_FLAGS) |
| 52 | + |
| 53 | +DOCKER_TAG=$(ARCH)-$(PROJECT_VERSION) |
| 54 | +BASE_DOCKER_TAG=$(ARCH)-$(BASEIMAGE_RELEASE) |
| 55 | + |
| 56 | +DOCKER_GO_LDFLAGS += $(GO_LDFLAGS) |
| 57 | +DOCKER_GO_LDFLAGS += -linkmode external -extldflags '-static -lpthread' |
| 58 | + |
| 59 | + |
| 60 | + |
0 commit comments