github.com/hxx258456/fabric-ca-gm@v0.0.3-0.20221111064038-a268ad7e3a37/docker-env.mk (about)

     1  # Copyright London Stock Exchange Group All Rights Reserved.
     2  #
     3  # SPDX-License-Identifier: Apache-2.0
     4  
     5  ifneq ($(http_proxy),)
     6  DOCKER_BUILD_FLAGS+=--build-arg http_proxy=$(http_proxy)
     7  endif
     8  ifneq ($(https_proxy),)
     9  DOCKER_BUILD_FLAGS+=--build-arg https_proxy=$(https_proxy)
    10  endif
    11  ifneq ($(HTTP_PROXY),)
    12  DOCKER_BUILD_FLAGS+=--build-arg HTTP_PROXY=$(HTTP_PROXY)
    13  endif
    14  ifneq ($(HTTPS_PROXY),)
    15  DOCKER_BUILD_FLAGS+=--build-arg HTTPS_PROXY=$(HTTPS_PROXY)
    16  endif
    17  ifneq ($(no_proxy),)
    18  DOCKER_BUILD_FLAGS+=--build-arg no_proxy=$(no_proxy)
    19  endif
    20  ifneq ($(NO_PROXY),)
    21  DOCKER_BUILD_FLAGS+=--build-arg NO_PROXY=$(NO_PROXY)
    22  endif
    23  
    24  DBUILD = docker build $(DOCKER_BUILD_FLAGS)
    25  
    26  DOCKER_NS ?= gcbaas-gm
    27  DOCKER_TAG=$(ARCH)-$(PROJECT_VERSION)
    28  
    29  DOCKER_GO_LDFLAGS += $(GO_LDFLAGS)
    30  DOCKER_GO_LDFLAGS += -linkmode external -extldflags '-lpthread'
    31  
    32  #
    33  # What is a .dummy file?
    34  #
    35  # Make is designed to work with files.  It uses the presence (or lack thereof)
    36  # and timestamps of files when deciding if a given target needs to be rebuilt.
    37  # Docker containers throw a wrench into the works because the output of docker
    38  # builds do not translate into standard files that makefile rules can evaluate.
    39  # Therefore, we have to fake it.  We do this by constructioning our rules such
    40  # as
    41  #       my-docker-target/.dummy:
    42  #              docker build ...
    43  #              touch $@
    44  #
    45  # If the docker-build succeeds, the touch operation creates/updates the .dummy
    46  # file.  If it fails, the touch command never runs.  This means the .dummy
    47  # file follows relatively 1:1 with the underlying container.
    48  #
    49  # This isn't perfect, however.  For instance, someone could delete a docker
    50  # container using docker-rmi outside of the build, and make would be fooled
    51  # into thinking the dependency is statisfied when it really isn't.  This is
    52  # our closest approximation we can come up with.
    53  #
    54  # As an aside, also note that we incorporate the version number in the .dummy
    55  # file to differentiate different tags to fix FAB-1145
    56  #
    57  DUMMY = .dummy-$(DOCKER_TAG)