diff --git a/.gitignore b/.gitignore index 4fd4de2bda..488fc5f281 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist/*.tar.gz dist/flanneld* dist/iptables-* +dist/libpthread* dist/*.aci dist/*.docker cover.out diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index 01922e00a4..d3be5f988c 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -5,5 +5,6 @@ MAINTAINER Tom Denham COPY dist/flanneld-amd64 /opt/bin/flanneld COPY dist/iptables-amd64 /usr/local/bin/iptables COPY dist/mk-docker-opts.sh /opt/bin/ +COPY dist/libpthread.so.0-amd64 /lib/libpthread.so.0 CMD ["/opt/bin/flanneld"] diff --git a/Dockerfile.arm b/Dockerfile.arm index 3539b71254..d0d56a0259 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -5,4 +5,5 @@ MAINTAINER Tom Denham COPY dist/flanneld-arm /opt/bin/flanneld COPY dist/iptables-arm /usr/local/bin/iptables COPY dist/mk-docker-opts.sh /opt/bin/ -CMD ["/opt/bin/flanneld"] \ No newline at end of file +COPY dist/libpthread.so.0-arm /lib/libpthread.so.0 +CMD ["/opt/bin/flanneld"] diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index bd3cea3c81..6413b7891b 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -5,5 +5,6 @@ MAINTAINER Tom Denham COPY dist/flanneld-arm64 /opt/bin/flanneld COPY dist/iptables-arm64 /usr/local/bin/iptables COPY dist/mk-docker-opts.sh /opt/bin/ +COPY dist/libpthread.so.0-arm64 /lib/libpthread.so.0 CMD ["/opt/bin/flanneld"] diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le index fed786e0a3..ed6ce2c8c6 100644 --- a/Dockerfile.ppc64le +++ b/Dockerfile.ppc64le @@ -5,5 +5,6 @@ MAINTAINER Tom Denham COPY dist/flanneld-ppc64le /opt/bin/flanneld COPY dist/iptables-ppc64le /usr/local/bin/iptables COPY dist/mk-docker-opts.sh /opt/bin/ +COPY dist/libpthread.so.0-ppc64le /lib/libpthread.so.0 CMD ["/opt/bin/flanneld"] diff --git a/Makefile b/Makefile index 88ee3a8722..e32bbc8b67 100644 --- a/Makefile +++ b/Makefile @@ -15,15 +15,19 @@ PACKAGES_EXPANDED=$(PACKAGES:%=github.com/coreos/flannel/%) # Set the (cross) compiler to use for different architectures ifeq ($(ARCH),amd64) + LIB_DIR=x86_64-linux-gnu CC=gcc endif ifeq ($(ARCH),arm) + LIB_DIR=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc endif ifeq ($(ARCH),arm64) + LIB_DIR=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc endif ifeq ($(ARCH),ppc64le) + LIB_DIR=powerpc64le-linux-gnu CC=powerpc64le-linux-gnu-gcc endif GOARM=6 @@ -62,9 +66,9 @@ clean: rm -f dist/*.tar.gz ## Create a docker image on disk for a specific arch and tag -dist/flanneld-$(ARCH)-$(TAG).docker: dist/flanneld-$(ARCH) dist/iptables-$(ARCH) - docker build -f Dockerfile.$(ARCH) -t $(REGISTRY)/flannel-$(ARCH):$(TAG) . - docker save -o dist/flanneld-$(ARCH)-$(TAG).docker $(REGISTRY)/flannel-$(ARCH):$(TAG) +dist/flanneld-$(TAG)-$(ARCH).docker: dist/flanneld-$(ARCH) dist/iptables-$(ARCH) dist/libpthread.so.0-$(ARCH) + docker build -f Dockerfile.$(ARCH) -t $(REGISTRY)/flannel:$(TAG)-$(ARCH) . + docker save -o dist/flanneld-$(TAG)-$(ARCH).docker $(REGISTRY)/flannel:$(TAG)-$(ARCH) # amd64 gets an image with the suffix too (i.e. it's the default) ifeq ($(ARCH),amd64) @@ -72,15 +76,15 @@ ifeq ($(ARCH),amd64) endif ## Create an ACI on disk for a specific arch and tag -dist/flanneld-$(ARCH)-$(TAG).aci: dist/flanneld-$(ARCH)-$(TAG).docker - docker2aci dist/flanneld-$(ARCH)-$(TAG).docker - mv quay.io-coreos-flannel-$(ARCH)-$(TAG).aci dist/flanneld-$(ARCH)-$(TAG).aci +dist/flanneld-$(TAG)-$(ARCH).aci: dist/flanneld-$(TAG)-$(ARCH).docker + docker2aci dist/flanneld-$(TAG)-$(ARCH).docker + mv quay.io-coreos-flannel-$(TAG)-$(ARCH).aci dist/flanneld-$(TAG)-$(ARCH).aci actool patch-manifest --replace --capability=CAP_NET_ADMIN \ --mounts=run-flannel,path=/run/flannel,readOnly=false:etc-ssl-etcd,path=/etc/ssl/etcd,readOnly=true:dev-net,path=/dev/net,readOnly=false \ - dist/flanneld-$(ARCH)-$(TAG).aci + dist/flanneld-$(TAG)-$(ARCH).aci -docker-push: dist/flanneld-$(ARCH)-$(TAG).docker - docker push $(REGISTRY)/flannel-$(ARCH):$(TAG) +docker-push: dist/flanneld-$(TAG)-$(ARCH).docker + docker push $(REGISTRY)/flannel:$(TAG)-$(ARCH) # amd64 gets an image with the suffix too (i.e. it's the default) ifeq ($(ARCH),amd64) @@ -89,8 +93,8 @@ endif ## Build an architecture specific flanneld binary dist/flanneld-$(ARCH): - # Build for other platforms with ARCH=$ARCH make build - # valid values for $ARCH are [amd64 arm arm64 ppc64le] + # Build for other platforms with ARCH=$$ARCH make build + # valid values for $$ARCH are [amd64 arm arm64 ppc64le] docker run -e CC=$(CC) -e GOARM=$(GOARM) -e GOARCH=$(ARCH) -it \ -u $(shell id -u):$(shell id -u) \ -v ${PWD}:/go/src/github.com/coreos/flannel:ro \ @@ -101,6 +105,10 @@ dist/flanneld-$(ARCH): mv dist/flanneld dist/flanneld-$(ARCH) && \ file dist/flanneld-$(ARCH)' +## Busybox images are missing pthread. Pull it out of the kube-cross image +dist/libpthread.so.0-$(ARCH): + docker run -ti --rm -v `pwd`:/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp /lib/$(LIB_DIR)/libpthread.so.0 /host/dist/libpthread.so.0-$(ARCH) + ## Build an architecture specific iptables binary dist/iptables-$(ARCH): docker run -e CC=$(CC) -e GOARM=$(GOARM) -e GOARCH=$(ARCH) -it \ @@ -132,10 +140,10 @@ dist/flannel-$(TAG)-linux-amd64.tar.gz: ## Make a release after creating a tag release: dist/flannel-$(TAG)-linux-amd64.tar.gz - ARCH=amd64 make dist/flanneld-amd64-$(TAG).aci - ARCH=arm make dist/flanneld-arm-$(TAG).aci - ARCH=arm64 make dist/flanneld-arm64-$(TAG).aci - ARCH=ppc64le make dist/flanneld-ppc64le-$(TAG).aci + ARCH=amd64 make dist/flanneld-$(TAG)-amd64.aci + ARCH=arm make dist/flanneld-$(TAG)-arm.aci + ARCH=arm64 make dist/flanneld-$(TAG)-arm64.aci + ARCH=ppc64le make dist/flanneld-$(TAG)-ppc64le.aci @echo "Everything should be built for $(TAG)" @echo "Add all *.aci, flanneld-* and *.tar.gz files from dist/ to the Github release" @echo "Use make docker-push-all to push the images to a registry"