github.com/adecaro/fabric-ca@v2.0.0-alpha+incompatible/docker-env.mk (about)

     1  # Copyright London Stock Exchange Group All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #      http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  ifneq ($(shell uname),Darwin)
    16  DOCKER_RUN_FLAGS=--user=$(shell id -u)
    17  endif
    18  
    19  ifneq ($(http_proxy),)
    20  DOCKER_BUILD_FLAGS+=--build-arg http_proxy=$(http_proxy)
    21  DOCKER_RUN_FLAGS+=-e http_proxy=$(http_proxy)
    22  endif
    23  ifneq ($(https_proxy),)
    24  DOCKER_BUILD_FLAGS+=--build-arg https_proxy=$(https_proxy)
    25  DOCKER_RUN_FLAGS+=-e https_proxy=$(https_proxy)
    26  endif
    27  ifneq ($(HTTP_PROXY),)
    28  DOCKER_BUILD_FLAGS+=--build-arg HTTP_PROXY=$(HTTP_PROXY)
    29  DOCKER_RUN_FLAGS+=-e HTTP_PROXY=$(HTTP_PROXY)
    30  endif
    31  ifneq ($(HTTPS_PROXY),)
    32  DOCKER_BUILD_FLAGS+=--build-arg HTTPS_PROXY=$(HTTPS_PROXY)
    33  DOCKER_RUN_FLAGS+=-e HTTPS_PROXY=$(HTTPS_PROXY)
    34  endif
    35  ifneq ($(no_proxy),)
    36  DOCKER_BUILD_FLAGS+=--build-arg no_proxy=$(no_proxy)
    37  DOCKER_RUN_FLAGS+=-e no_proxy=$(no_proxy)
    38  endif
    39  ifneq ($(NO_PROXY),)
    40  DOCKER_BUILD_FLAGS+=--build-arg NO_PROXY=$(NO_PROXY)
    41  DOCKER_RUN_FLAGS+=-e NO_PROXY=$(NO_PROXY)
    42  endif
    43  
    44  DRUN = docker run -i --rm $(DOCKER_RUN_FLAGS) \
    45  	-v $(abspath .):/opt/gopath/src/$(PKGNAME) \
    46  	-w /opt/gopath/src/$(PKGNAME)
    47  
    48  DBUILD = docker build $(DOCKER_BUILD_FLAGS)
    49  
    50  BASE_DOCKER_NS ?= hyperledger
    51  BASE_DOCKER_TAG=$(ARCH)-$(BASEIMAGE_RELEASE)
    52  
    53  DOCKER_NS ?= hyperledger
    54  NEXUS_URL ?= nexus3.hyperledger.org:10001/hyperledger
    55  DOCKER_TAG=$(ARCH)-$(PROJECT_VERSION)
    56  
    57  DOCKER_GO_LDFLAGS += $(GO_LDFLAGS)
    58  DOCKER_GO_LDFLAGS += -linkmode external -extldflags '-lpthread'
    59  
    60  #
    61  # What is a .dummy file?
    62  #
    63  # Make is designed to work with files.  It uses the presence (or lack thereof)
    64  # and timestamps of files when deciding if a given target needs to be rebuilt.
    65  # Docker containers throw a wrench into the works because the output of docker
    66  # builds do not translate into standard files that makefile rules can evaluate.
    67  # Therefore, we have to fake it.  We do this by constructioning our rules such
    68  # as
    69  #       my-docker-target/.dummy:
    70  #              docker build ...
    71  #              touch $@
    72  #
    73  # If the docker-build succeeds, the touch operation creates/updates the .dummy
    74  # file.  If it fails, the touch command never runs.  This means the .dummy
    75  # file follows relatively 1:1 with the underlying container.
    76  #
    77  # This isn't perfect, however.  For instance, someone could delete a docker
    78  # container using docker-rmi outside of the build, and make would be fooled
    79  # into thinking the dependency is statisfied when it really isn't.  This is
    80  # our closest approximation we can come up with.
    81  #
    82  # As an aside, also note that we incorporate the version number in the .dummy
    83  # file to differentiate different tags to fix FAB-1145
    84  #
    85  DUMMY = .dummy-$(DOCKER_TAG)
    86  
    87  
    88