-
Notifications
You must be signed in to change notification settings - Fork 1
/
istio-cni-docker.mk
63 lines (50 loc) · 2.49 KB
/
istio-cni-docker.mk
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
## Copyright 2018 Istio Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
.PHONY: docker
# Docker target will build the go binaries and package the docker for local testing.
# It does not upload to a registry.
#docker: build test-bins docker.all
docker: build docker.all
$(ISTIO_DOCKER) $(ISTIO_DOCKER_TAR):
mkdir -p $@
.SECONDEXPANSION: #allow $@ to be used in dependency list
# directives to copy files to docker scratch directory
# tell make which files are copied from go/out
DOCKER_FILES_FROM_ISTIO_OUT:=istio-cni
$(foreach FILE,$(DOCKER_FILES_FROM_ISTIO_OUT), \
$(eval $(ISTIO_DOCKER)/$(FILE): $(ISTIO_OUT)/$(FILE) | $(ISTIO_DOCKER); cp $$< $$(@D)))
# tell make which files are copied from the source tree
DOCKER_FILES_FROM_SOURCE:=tools/deb/istio-iptables.sh
$(foreach FILE,$(DOCKER_FILES_FROM_SOURCE), \
$(eval $(ISTIO_DOCKER)/$(notdir $(FILE)): $(FILE) | $(ISTIO_DOCKER); cp $(FILE) $$(@D)))
docker.install-cni: $(ISTIO_OUT)/istio-cni tools/deb/istio-iptables.sh \
deployments/kubernetes/install/scripts/install-cni.sh \
deployments/kubernetes/install/scripts/istio-cni.conf.default \
deployments/kubernetes/Dockerfile.install-cni \
deployments/kubernetes/install/scripts/filter.jq
mkdir -p $(ISTIO_DOCKER)/install-cni
cp $^ $(ISTIO_DOCKER)/install-cni
time (cd $(ISTIO_DOCKER)/install-cni && \
docker build -t $(HUB)/install-cni:$(TAG) -f Dockerfile.install-cni .)
DOCKER_TARGETS:=docker.install-cni
# create a DOCKER_PUSH_TARGETS that's each of DOCKER_TARGETS with a push. prefix
DOCKER_PUSH_TARGETS:=
$(foreach TGT,$(DOCKER_TARGETS),$(eval DOCKER_PUSH_TARGETS+=push.$(TGT)))
# for each docker.XXX target create a push.docker.XXX target that pushes
# the local docker image to another hub
# a possible optimization is to use tag.$(TGT) as a dependency to do the tag for us
$(foreach TGT,$(DOCKER_TARGETS),$(eval push.$(TGT): | $(TGT) ; \
time (docker push $(HUB)/$(subst docker.,,$(TGT)):$(TAG))))
# Will build and push docker images.
docker.push: $(DOCKER_PUSH_TARGETS)