Bladeren bron

Builds: Insert libpthread into busybox images

Tom Denham 8 jaren geleden
bovenliggende
commit
2243d07b41
6 gewijzigde bestanden met toevoegingen van 24 en 11 verwijderingen
  1. 1 0
      .gitignore
  2. 1 0
      Dockerfile.amd64
  3. 2 1
      Dockerfile.arm
  4. 1 0
      Dockerfile.arm64
  5. 1 0
      Dockerfile.ppc64le
  6. 18 10
      Makefile

+ 1 - 0
.gitignore

@@ -1,6 +1,7 @@
 dist/*.tar.gz
 dist/flanneld*
 dist/iptables-*
+dist/libpthread*
 dist/*.aci
 dist/*.docker
 cover.out

+ 1 - 0
Dockerfile.amd64

@@ -5,5 +5,6 @@ MAINTAINER Tom Denham <tom@tigera.io>
 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"]
 

+ 2 - 1
Dockerfile.arm

@@ -5,4 +5,5 @@ MAINTAINER Tom Denham <tom@tigera.io>
 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"]
+COPY dist/libpthread.so.0-arm /lib/libpthread.so.0
+CMD ["/opt/bin/flanneld"]

+ 1 - 0
Dockerfile.arm64

@@ -5,5 +5,6 @@ MAINTAINER Tom Denham <tom@tigera.io>
 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"]
 

+ 1 - 0
Dockerfile.ppc64le

@@ -5,5 +5,6 @@ MAINTAINER Tom Denham <tom@tigera.io>
 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"]
 

+ 18 - 10
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,7 +66,7 @@ clean:
 	rm -f dist/*.tar.gz
 
 ## Create a docker image on disk for a specific arch and tag
-dist/flanneld-$(TAG)-$(ARCH).docker: dist/flanneld-$(ARCH) dist/iptables-$(ARCH)
+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)
 
@@ -72,12 +76,12 @@ 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
+dist/flanneld-$(TAG)-$(ARCH).aci: dist/flanneld-$(TAG)-$(ARCH).docker
 	docker2aci dist/flanneld-$(TAG)-$(ARCH).docker
-	mv quay.io-coreos-flannel-$(ARCH)-$(TAG).aci dist/flanneld-$(ARCH)-$(TAG).aci
+	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-$(TAG)-$(ARCH).docker
 	docker push $(REGISTRY)/flannel:$(TAG)-$(ARCH)
@@ -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"