2016-06-03 00:25:58 +00:00
|
|
|
# Copyright 2016 The Kubernetes Authors.
|
2016-02-03 06:30:10 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2018-01-08 17:08:30 +00:00
|
|
|
.PHONY: all push container clean orphan all-push push-manifest
|
|
|
|
|
|
|
|
include ../../hack/make-rules/Makefile.manifest
|
2015-03-31 21:52:12 +00:00
|
|
|
|
Switch to k8s.gcr.io vanity domain
This is the 2nd attempt. The previous was reverted while we figured out
the regional mirrors (oops).
New plan: k8s.gcr.io is a read-only facade that auto-detects your source
region (us, eu, or asia for now) and pulls from the closest. To publish
an image, push k8s-staging.gcr.io and it will be synced to the regionals
automatically (similar to today). For now the staging is an alias to
gcr.io/google_containers (the legacy URL).
When we move off of google-owned projects (working on it), then we just
do a one-time sync, and change the google-internal config, and nobody
outside should notice.
We can, in parallel, change the auto-sync into a manual sync - send a PR
to "promote" something from staging, and a bot activates it. Nice and
visible, easy to keep track of.
2018-01-17 19:36:53 +00:00
|
|
|
REGISTRY ?= staging-k8s.gcr.io
|
2018-01-08 17:08:30 +00:00
|
|
|
IMAGE = $(REGISTRY)/pause
|
|
|
|
IMAGE_WITH_ARCH = $(IMAGE)-$(ARCH)
|
2016-04-20 21:07:06 +00:00
|
|
|
|
2017-11-21 17:25:39 +00:00
|
|
|
TAG = 3.1
|
|
|
|
REV = $(shell git describe --contains --always --match='v*')
|
2015-03-31 21:52:12 +00:00
|
|
|
|
2016-11-18 13:52:21 +00:00
|
|
|
# Architectures supported: amd64, arm, arm64, ppc64le and s390x
|
2016-04-20 21:07:06 +00:00
|
|
|
ARCH ?= amd64
|
|
|
|
|
2016-11-18 13:52:21 +00:00
|
|
|
ALL_ARCH = amd64 arm arm64 ppc64le s390x
|
2016-04-20 21:07:06 +00:00
|
|
|
|
2017-11-21 17:25:39 +00:00
|
|
|
CFLAGS = -Os -Wall -Werror -static -DVERSION=v$(TAG)-$(REV)
|
Switch to k8s.gcr.io vanity domain
This is the 2nd attempt. The previous was reverted while we figured out
the regional mirrors (oops).
New plan: k8s.gcr.io is a read-only facade that auto-detects your source
region (us, eu, or asia for now) and pulls from the closest. To publish
an image, push k8s-staging.gcr.io and it will be synced to the regionals
automatically (similar to today). For now the staging is an alias to
gcr.io/google_containers (the legacy URL).
When we move off of google-owned projects (working on it), then we just
do a one-time sync, and change the google-internal config, and nobody
outside should notice.
We can, in parallel, change the auto-sync into a manual sync - send a PR
to "promote" something from staging, and a bot activates it. Nice and
visible, easy to keep track of.
2018-01-17 19:36:53 +00:00
|
|
|
KUBE_CROSS_IMAGE ?= k8s.gcr.io/kube-cross
|
2016-04-20 21:07:06 +00:00
|
|
|
KUBE_CROSS_VERSION ?= $(shell cat ../build-image/cross/VERSION)
|
|
|
|
|
|
|
|
BIN = pause
|
|
|
|
SRCS = pause.c
|
2016-04-01 18:01:35 +00:00
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
TRIPLE ?= x86_64-linux-gnu
|
|
|
|
endif
|
2015-11-23 03:53:45 +00:00
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
ifeq ($(ARCH),arm)
|
2017-11-21 17:25:39 +00:00
|
|
|
TRIPLE ?= arm-linux-gnueabihf
|
2016-04-20 21:07:06 +00:00
|
|
|
endif
|
2016-04-01 18:01:35 +00:00
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
ifeq ($(ARCH),arm64)
|
|
|
|
TRIPLE ?= aarch64-linux-gnu
|
|
|
|
endif
|
2016-04-01 18:01:35 +00:00
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
ifeq ($(ARCH),ppc64le)
|
|
|
|
TRIPLE ?= powerpc64le-linux-gnu
|
2016-04-01 18:01:35 +00:00
|
|
|
endif
|
|
|
|
|
2016-11-18 13:52:21 +00:00
|
|
|
ifeq ($(ARCH),s390x)
|
|
|
|
TRIPLE ?= s390x-linux-gnu
|
|
|
|
endif
|
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
# If you want to build AND push all containers, see the 'all-push' rule.
|
|
|
|
all: all-container
|
2016-04-01 18:01:35 +00:00
|
|
|
|
2018-01-08 17:08:30 +00:00
|
|
|
all-push: all-push-images push-manifest
|
|
|
|
|
|
|
|
push-manifest: manifest-tool
|
|
|
|
manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(IMAGE)-ARCH:$(TAG) --target $(IMAGE):$(TAG)
|
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
sub-container-%:
|
|
|
|
$(MAKE) ARCH=$* container
|
|
|
|
|
|
|
|
sub-push-%:
|
|
|
|
$(MAKE) ARCH=$* push
|
|
|
|
|
|
|
|
all-container: $(addprefix sub-container-,$(ALL_ARCH))
|
|
|
|
|
2018-01-08 17:08:30 +00:00
|
|
|
all-push-images: $(addprefix sub-push-,$(ALL_ARCH))
|
2016-04-20 21:07:06 +00:00
|
|
|
|
|
|
|
build: bin/$(BIN)-$(ARCH)
|
|
|
|
|
|
|
|
bin/$(BIN)-$(ARCH): $(SRCS)
|
|
|
|
mkdir -p bin
|
2016-12-29 17:22:00 +00:00
|
|
|
docker run --rm -u $$(id -u):$$(id -g) -v $$(pwd):/build \
|
2016-04-20 21:07:06 +00:00
|
|
|
$(KUBE_CROSS_IMAGE):$(KUBE_CROSS_VERSION) \
|
|
|
|
/bin/bash -c "\
|
|
|
|
cd /build && \
|
|
|
|
$(TRIPLE)-gcc $(CFLAGS) -o $@ $^ && \
|
|
|
|
$(TRIPLE)-strip $@"
|
|
|
|
|
|
|
|
container: .container-$(ARCH)
|
|
|
|
.container-$(ARCH): bin/$(BIN)-$(ARCH)
|
2018-01-08 17:08:30 +00:00
|
|
|
docker build --pull -t $(IMAGE_WITH_ARCH):$(TAG) --build-arg ARCH=$(ARCH) .
|
2016-04-20 21:07:06 +00:00
|
|
|
touch $@
|
2015-03-31 21:52:12 +00:00
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
push: .push-$(ARCH)
|
|
|
|
.push-$(ARCH): .container-$(ARCH)
|
2018-02-24 05:54:24 +00:00
|
|
|
docker push $(IMAGE_WITH_ARCH):$(TAG)
|
2016-04-20 21:07:06 +00:00
|
|
|
touch $@
|
|
|
|
|
2016-11-14 11:30:33 +00:00
|
|
|
# Useful for testing, not automatically included in container image
|
|
|
|
orphan: bin/orphan-$(ARCH)
|
|
|
|
bin/orphan-$(ARCH): orphan.c
|
|
|
|
mkdir -p bin
|
|
|
|
docker run -u $$(id -u):$$(id -g) -v $$(pwd):/build \
|
|
|
|
$(KUBE_CROSS_IMAGE):$(KUBE_CROSS_VERSION) \
|
|
|
|
/bin/bash -c "\
|
|
|
|
cd /build && \
|
|
|
|
$(TRIPLE)-gcc $(CFLAGS) -o $@ $^ && \
|
|
|
|
$(TRIPLE)-strip $@"
|
|
|
|
|
2016-04-20 21:07:06 +00:00
|
|
|
clean:
|
|
|
|
rm -rf .container-* .push-* bin/
|