Add a flannel image for arm and amd64. Cross-build debian-iptables for arm, arm64 and ppc64le. Build and push hyperkube for arm on every release

This commit is contained in:
Lucas Käldström
2016-04-04 23:33:32 +03:00
parent b50e89e323
commit 560268e036
11 changed files with 257 additions and 47 deletions

View File

@@ -12,10 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:jessie
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/
# All apt-get's must be in one run command or the
# cleanup has no effect.
RUN apt-get update && \
apt-get install -y iptables && \
ls /var/lib/apt/lists/*debian* | xargs rm
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y iptables \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -14,13 +14,47 @@
.PHONY: build push
IMAGE = debian-iptables
TAG = v1
REGISTRY?="gcr.io/google_containers"
IMAGE=debian-iptables
TAG=v2
ARCH?=amd64
TEMP_DIR:=$(shell mktemp -d)
ifeq ($(ARCH),amd64)
BASEIMAGE?=debian:jessie
endif
ifeq ($(ARCH),arm)
BASEIMAGE?=armel/debian:jessie
QEMUARCH=arm
endif
ifeq ($(ARCH),arm64)
BASEIMAGE?=aarch64/debian:jessie
QEMUARCH=aarch64
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE?=ppc64le/debian:jessie
QEMUARCH=ppc64le
endif
build:
docker build -t gcr.io/google_containers/$(IMAGE):$(TAG) .
cp ./* $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
cd $(TEMP_DIR) && sed -i "s|ARCH|$(QEMUARCH)|g" Dockerfile
push: build
gcloud docker --server=gcr.io push gcr.io/google_containers/$(IMAGE):$(TAG)
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/v2.5.0/x86_64_qemu-$(QEMUARCH)-static.tar.xz | tar -xJ -C $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s/CROSS_BUILD_//g" Dockerfile
endif
all: push
docker build -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
push: build
gcloud docker push $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG)
all: push

View File

@@ -0,0 +1,29 @@
### debian-iptables
Serves as the base image for `gcr.io/google_containers/kube-proxy-${ARCH}` and multiarch (not `amd64`) `gcr.io/google_containers/flannel-${ARCH}` images.
This image is compiled for multiple architectures.
#### How to release
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
# ---> gcr.io/google_containers/debian-iptables-amd64:TAG
$ make push ARCH=arm
# ---> gcr.io/google_containers/debian-iptables-arm:TAG
$ make push ARCH=arm64
# ---> gcr.io/google_containers/debian-iptables-arm64:TAG
$ make push ARCH=ppc64le
# ---> gcr.io/google_containers/debian-iptables-ppc64le:TAG
```
If you don't want to push the images, run `make` or `make build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/debian-iptables/README.md?pixel)]()