mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 21:10:22 +00:00
61 lines
1.8 KiB
Makefile
61 lines
1.8 KiB
Makefile
# Copyright 2016 The Kubernetes 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: build push
|
|
|
|
REGISTRY?="staging-k8s.gcr.io"
|
|
IMAGE=debian-iptables
|
|
TAG=v10
|
|
ARCH?=amd64
|
|
TEMP_DIR:=$(shell mktemp -d)
|
|
QEMUVERSION=v2.9.1
|
|
|
|
ifeq ($(ARCH),arm)
|
|
QEMUARCH=arm
|
|
endif
|
|
ifeq ($(ARCH),arm64)
|
|
QEMUARCH=aarch64
|
|
endif
|
|
ifeq ($(ARCH),ppc64le)
|
|
QEMUARCH=ppc64le
|
|
endif
|
|
ifeq ($(ARCH),s390x)
|
|
QEMUARCH=s390x
|
|
endif
|
|
|
|
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.3
|
|
|
|
build:
|
|
cp ./* $(TEMP_DIR)
|
|
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
|
|
cd $(TEMP_DIR) && sed -i "s|ARCH|$(QEMUARCH)|g" Dockerfile
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
|
|
cd $(TEMP_DIR) && sed -i "/CROSS_BUILD_/d" Dockerfile
|
|
else
|
|
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
|
|
# Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel
|
|
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)
|
|
cd $(TEMP_DIR) && sed -i "s/CROSS_BUILD_//g" Dockerfile
|
|
endif
|
|
|
|
docker build --pull -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
|
|
|
|
push: build
|
|
docker push $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG)
|
|
|
|
all: push
|