Fresh dep ensure

This commit is contained in:
Mike Cronce
2018-11-26 13:23:56 -05:00
parent 93cb8a04d7
commit 407478ab9a
9016 changed files with 551394 additions and 279685 deletions

View File

@ -14,13 +14,10 @@
FROM BASEIMAGE
# If we're building for another architecture than amd64, the CROSS_BUILD_ placeholder is removed so e.g. CROSS_BUILD_COPY turns into COPY
# If we're building normally, for amd64, CROSS_BUILD lines are removed
CROSS_BUILD_COPY qemu-ARCH-static /usr/bin/
RUN clean-install \
conntrack \
ebtables \
ipset \
iptables \
kmod
kmod \
netbase

View File

@ -12,49 +12,51 @@
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: build push
.PHONY: build push all all-build all-push-images all-push push-manifest
REGISTRY?="staging-k8s.gcr.io"
IMAGE=debian-iptables
TAG=v10
IMAGE=$(REGISTRY)/debian-iptables
TAG?=v11.0
ARCH?=amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
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.4.0
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.3
# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
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
ifneq ($(ARCH),amd64)
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
endif
docker build --pull -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
docker build --pull -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
push: build
docker push $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG)
docker push $(IMAGE)-$(ARCH):$(TAG)
all: push
sub-build-%:
$(MAKE) ARCH=$* build
all-build: $(addprefix sub-build-,$(ALL_ARCH))
sub-push-image-%:
$(MAKE) ARCH=$* push
all-push-images: $(addprefix sub-push-image-,$(ALL_ARCH))
all-push: all-push-images push-manifest
push-manifest:
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done
docker manifest push --purge ${IMAGE}:${TAG}
all: all-push

View File

@ -9,24 +9,16 @@ This image is compiled for multiple architectures.
If you're editing the Dockerfile or some other thing, please bump the `TAG` in the Makefile.
```console
# Build for linux/amd64 (default)
$ make push ARCH=amd64
Build and push images for all the architectures
$ make all-push
# ---> staging-k8s.gcr.io/debian-iptables-amd64:TAG
$ make push ARCH=arm
# ---> staging-k8s.gcr.io/debian-iptables-arm:TAG
$ make push ARCH=arm64
# ---> staging-k8s.gcr.io/debian-iptables-arm64:TAG
$ make push ARCH=ppc64le
# ---> staging-k8s.gcr.io/debian-iptables-ppc64le:TAG
$ make push ARCH=s390x
# ---> staging-k8s.gcr.io/debian-iptables-s390x:TAG
```
If you don't want to push the images, run `make` or `make build` instead
If you don't want to push the images, run `make build ARCH={target_arch}` or `make all-build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/debian-iptables/README.md?pixel)]()