Skip to content

Commit

Permalink
Makefile: Switch to a new version of kube-cross
Browse files Browse the repository at this point in the history
This means we're now using a newer version of go and
arm-linux-gnueabihf-gcc instead of arm-linux-gnueabi-gcc

Also, switch to an alpine base image for amd64
  • Loading branch information
tomdee committed Apr 14, 2017
1 parent 456d4f5 commit 444ef90
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ dist/*.tar.gz
dist/flanneld*
dist/iptables-*
dist/libpthread*
dist/ld64*
dist/libc*
dist/*.aci
dist/*.docker
cover.out
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM busybox:1.25.0-glibc
FROM frolvlad/alpine-glibc

MAINTAINER Tom Denham <[email protected]>

COPY dist/flanneld-amd64 /opt/bin/flanneld
COPY dist/iptables-amd64 /usr/local/bin/iptables
ENV FLANNEL_ARCH=amd64

COPY dist/flanneld-$FLANNEL_ARCH /opt/bin/flanneld
COPY dist/iptables-$FLANNEL_ARCH /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"]

12 changes: 9 additions & 3 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ FROM armel/busybox:glibc

MAINTAINER Tom Denham <[email protected]>

COPY dist/flanneld-arm /opt/bin/flanneld
COPY dist/iptables-arm /usr/local/bin/iptables
ENV FLANNEL_ARCH=arm

COPY dist/flanneld-$FLANNEL_ARCH /opt/bin/flanneld
COPY dist/iptables-$FLANNEL_ARCH /usr/local/bin/iptables
COPY dist/mk-docker-opts.sh /opt/bin/
COPY dist/libpthread.so.0-arm /lib/libpthread.so.0
COPY dist/libpthread.so.0-$FLANNEL_ARCH /lib/libpthread.so.0
COPY dist/ld64.so.1-$FLANNEL_ARCH /lib/ld64.so.1
COPY dist/libc.so.6-$FLANNEL_ARCH /lib/libc.so.6


CMD ["/opt/bin/flanneld"]
12 changes: 7 additions & 5 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ FROM aarch64/busybox:glibc

MAINTAINER Tom Denham <[email protected]>

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"]
ENV FLANNEL_ARCH=arm64

COPY dist/flanneld-$FLANNEL_ARCH /opt/bin/flanneld
COPY dist/iptables-$FLANNEL_ARCH /usr/local/bin/iptables
COPY dist/mk-docker-opts.sh /opt/bin/
COPY dist/libpthread.so.0-$FLANNEL_ARCH /lib/libpthread.so.0
COPY dist/ld64.so.1-$FLANNEL_ARCH /lib/ld64.so.1
COPY dist/libc.so.6-$FLANNEL_ARCH /lib/libc.so.6
12 changes: 7 additions & 5 deletions Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ FROM ppc64le/busybox:glibc

MAINTAINER Tom Denham <[email protected]>

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"]
ENV FLANNEL_ARCH=ppc64le

COPY dist/flanneld-$FLANNEL_ARCH /opt/bin/flanneld
COPY dist/iptables-$FLANNEL_ARCH /usr/local/bin/iptables
COPY dist/mk-docker-opts.sh /opt/bin/
COPY dist/libpthread.so.0-$FLANNEL_ARCH /lib/libpthread.so.0
COPY dist/ld64.so.1-$FLANNEL_ARCH /lib/ld64.so.1
COPY dist/libc.so.6-$FLANNEL_ARCH /lib/libc.so.6
13 changes: 8 additions & 5 deletions Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ FROM s390x/busybox:glibc

MAINTAINER Tom Denham <[email protected]>

COPY dist/flanneld-s390x /opt/bin/flanneld
COPY dist/iptables-s390x /usr/local/bin/iptables
ENV FLANNEL_ARCH=s390x

COPY dist/flanneld-$FLANNEL_ARCH /opt/bin/flanneld
COPY dist/iptables-$FLANNEL_ARCH /usr/local/bin/iptables
COPY dist/mk-docker-opts.sh /opt/bin/
COPY dist/libpthread.so.0-s390x /lib/libpthread.so.0
COPY dist/ld64.so.1 /lib/ld64.so.1
COPY dist/libc.so.6 /lib/libc.so.6
COPY dist/libpthread.so.0-$FLANNEL_ARCH /lib/libpthread.so.0
COPY dist/ld64.so.1-$FLANNEL_ARCH /lib/ld64.so.1
COPY dist/libc.so.6-$FLANNEL_ARCH /lib/libc.so.6

CMD ["/opt/bin/flanneld"]
37 changes: 15 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,30 @@ 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
LIB_DIR=/lib/x86_64-linux-gnu
CC=gcc
endif
ifeq ($(ARCH),arm)
LIB_DIR=arm-linux-gnueabi
CC=arm-linux-gnueabi-gcc
LIB_DIR=/usr/arm-linux-gnueabihf/lib
CC=arm-linux-gnueabihf-gcc
endif
ifeq ($(ARCH),arm64)
LIB_DIR=aarch64-linux-gnu
LIB_DIR=/usr/aarch64-linux-gnu/lib
CC=aarch64-linux-gnu-gcc
endif
ifeq ($(ARCH),ppc64le)
LIB_DIR=powerpc64le-linux-gnu
LIB_DIR=/usr/powerpc64le-linux-gnu/lib
CC=powerpc64le-linux-gnu-gcc
endif
ifeq ($(ARCH),s390x)
LIB_DIR=s390x-linux-gnu
CC=s390x-linux-gnu-gcc
endif
GOARM=6
ifeq ($(ARCH),s390x)
# kube-cross:v1.7.4-1 supports s390x
KUBE_CROSS_TAG=v1.7.4-1
else
KUBE_CROSS_TAG=v1.6.2-2
endif

GOARM=7

# List images with gcloud alpha container images list-tags gcr.io/google_containers/kube-cross
KUBE_CROSS_TAG=v1.7.5-3
IPTABLES_VERSION=1.4.21

dist/flanneld: $(shell find . -type f -name '*.go')
Expand Down Expand Up @@ -117,16 +115,11 @@ 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):
ifeq ($(ARCH),s390x)
# Busybox images are having older version of libc.so.6 and ld64.so.1. Pull it out of the kube-cross image
docker run --rm -v `pwd`:/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp /usr/$(LIB_DIR)/lib/libpthread.so.0 /host/dist/libpthread.so.0-$(ARCH)
docker run --rm -v `pwd`:/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp /usr/$(LIB_DIR)/lib/libc-2.23.so /host/dist/libc.so.6
docker run --rm -v `pwd`:/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp /usr/$(LIB_DIR)/lib/ld-2.23.so /host/dist/ld64.so.1
else
docker run --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)
endif
## Busybox images need updated libs. Pull them out of the kube-cross image
dist/libpthread.so.0-$(ARCH) dist/libc.so.6-$(ARCH) dist/ld64.so.1-$(ARCH):
docker run --rm -v $(CURDIR):/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp $(LIB_DIR)/libc-2.23.so /host/dist/libc.so.6-$(ARCH)
docker run --rm -v $(CURDIR):/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp $(LIB_DIR)/ld-2.23.so /host/dist/ld64.so.1-$(ARCH)
docker run --rm -v $(CURDIR):/host gcr.io/google_containers/kube-cross:$(KUBE_CROSS_TAG) cp $(LIB_DIR)/libpthread.so.0 /host/dist/libpthread.so.0-$(ARCH)

## Build an architecture specific iptables binary
dist/iptables-$(ARCH):
Expand Down

0 comments on commit 444ef90

Please sign in to comment.