1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# build-container.mk contains utilities used by Makefiles to proxy commands to
# build containers.
#
# The following terminology is used throughout comments:
#
# callers Makefiles including this file
# users Users invoking `make`
#
# Users can supply the USE_CONTAINER=1 environment variable to inform targets
# that they should proxy build commands to the build container.
#
# Targets must opt-in to proxying support. Callers which wish to support
# proxying a Make target to the build container should be written with the
# following pattern:
#
# <make target>:
# ifeq $($(USE_CONTAINER),1)
# $(RERUN_IN_CONTAINER)
# else
# <logic>
# endif
#
# For example, for a `example` target to proxy an echo to a build container:
#
# example:
# ifeq ($(USE_CONTAINER),1)
# $(RERUN_IN_CONTAINER)
# else
# echo Hello, world!
# endif
#
# By default, no environment variables are propagated to the build container.
# Callers should set the PROPAGATE_VARS global variable to specify which
# variable names should be passed through to the container.
USE_CONTAINER ?=
BUILD_IMAGE_VERSION ?=
:DOCKER_OPTS ?=
#
# Build container cache. `make build-container-cache` will create two Docker
# volumes which are used for caching downloaded Go modules and built code.
# This dramatically speeds up subseqent builds.
#
# The following code checks to see if the volumes exist and appends them to
# DOCKER_OPTS if they do.
#
REGISTRY_CACHE_VOLUME :=
define volume_exists
endef
# Figure out if our build container should be using a build cache for Go.
REGISTRY_CACHE_EXISTS :=
:endif
endif
: :
:
#
# Miscellaneous
#
# Name of the makefile
PARENT_MAKEFILE :=
# Creates a build container and runs Make inside of it.
#
# Callers can use PROPAGATE_VARS to set which environment variables get passed
# through to the container. USE_CONTAINER should never get propagated.
define RERUN_IN_CONTAINER
endef