Skip to content

Conversation

@jjo
Copy link
Contributor

@jjo jjo commented Mar 12, 2018

Instrument Makefile to [ab]use GOARCH for

  • Explicitly add GOARCH env to go ... invocations, defaulting to amd64 (implicit current default)
  • Dockerfile.$(GOARCH).run overriding with proper alpine ARCH specific image
  • New multiarch-{setup,check,binverify} targets to aim local box cross-platform run-ability via
    /usr/bin/qemu-<ARCH>-static

Will add comments with actual run outputs.

@jjo
Copy link
Contributor Author

jjo commented Mar 12, 2018

Run outputs for the 3 plaforms (w/previous rm -f kube-router gobgp
(NOTE the Dockerfile.$(GOARCH).run FROM ... lines for specific arches).

FYI successfully running armhf build (image: xjjo/kube-router:armhf-v0.1.0-rc2-6-g4e768b1)
in my 3-nodes raspi cluster.

  • make container (no explicit GOARCH set from cmdline, thus adm64)
$ make container
Building for GOARCH=amd64
Starting kube-router binary build.
GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/cloudnativelabs/kube-router/app.version=v0.1.0-rc2-8-g5f3bd82 -X github.com/cloudnativelabs/kube-router/app.buildDate=2018-03-12' -o kube-router kube-router.go
Finished kube-router binary build.
docker run -v /home/jjo/work/src/github.com/cloudnativelabs/kube-router:/pwd golang:alpine \
    sh -c ' \
    apk add -U git && \
    ln -s /pwd/vendor /go/src && \
    CGO_ENABLED=0 GOARCH=amd64 go get github.com/osrg/gobgp/gobgp && \
    cp `find /go/bin -type f -name gobgp` /pwd'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libssh2 (1.8.0-r2)
(2/5) Installing libcurl (7.58.0-r1)
(3/5) Installing expat (2.2.5-r0)
(4/5) Installing pcre2 (10.30-r0)
(5/5) Installing git (2.15.0-r1)
Executing busybox-1.27.2-r7.trigger
OK: 19 MiB in 17 packages
Verifying kube-router gobgp for ARCH=x86-64 ...
Starting kube-router container image build.
docker build -t "cloudnativelabs/kube-router-git:jjo-add-arm-archs" -f Dockerfile.amd64.run .
Sending build context to Docker daemon  75.74MB
Step 1/9 : FROM alpine:3.7
 ---> 3fd9065eaf02
Step 2/9 : COPY kube-router gobgp /usr/local/bin/
 ---> 2ff803990537
Step 3/9 : COPY build/image-assets/bashrc /root/.bashrc
 ---> 0781fc7c2650
Step 4/9 : COPY build/image-assets/profile /root/.profile
 ---> 017914b4937d
Step 5/9 : COPY build/image-assets/vimrc /root/.vimrc
 ---> 65eb490821d1
Step 6/9 : COPY build/image-assets/motd-kube-router.sh /etc/motd-kube-router.sh
 ---> ef55005fa458
Step 7/9 : RUN apk add --no-cache       iptables       ipset       iproute2       ipvsadm       conntrack-tools       curl       bash &&     mkdir -p /var/lib/gobgp &&     mkdir -p /usr/local/share/bash-completion &&     curl -L -o /usr/local/share/bash-completion/bash-completion         https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion &&     cd &&     /usr/local/bin/gobgp --gen-cmpl --bash-cmpl-file /var/lib/gobgp/gobgp-completion.bash
 ---> Running in 0bdd62ce99a1
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/26) Installing pkgconf (1.3.10-r0)
(2/26) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(3/26) Installing ncurses-terminfo (6.0_p20171125-r0)
(4/26) Installing ncurses-libs (6.0_p20171125-r0)
(5/26) Installing readline (7.0.003-r0)
(6/26) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(7/26) Installing libmnl (1.0.4-r0)
(8/26) Installing libnfnetlink (1.0.1-r1)
(9/26) Installing libnetfilter_conntrack (1.0.6-r0)
(10/26) Installing libnetfilter_cthelper (1.0.0-r0)
(11/26) Installing libnetfilter_cttimeout (1.0.0-r0)
(12/26) Installing libnetfilter_queue (1.0.2-r0)
(13/26) Installing conntrack-tools (1.4.4-r0)
(14/26) Installing ca-certificates (20171114-r0)
(15/26) Installing libssh2 (1.8.0-r2)
(16/26) Installing libcurl (7.58.0-r1)
(17/26) Installing curl (7.58.0-r1)
(18/26) Installing libelf (0.8.13-r3)
(19/26) Installing jansson (2.10-r0)
(20/26) Installing libnftnl-libs (1.0.8-r1)
(21/26) Installing iptables (1.6.1-r1)
(22/26) Installing iproute2 (4.13.0-r0)
Executing iproute2-4.13.0-r0.post-install
(23/26) Installing ipset (6.34-r0)
(24/26) Installing libnl (1.1.4-r0)
(25/26) Installing popt (1.16-r7)
(26/26) Installing ipvsadm (1.29-r0)
Executing busybox-1.27.2-r7.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 20 MiB in 37 packages
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72448  100 72448    0     0  28909      0  0:00:02  0:00:02 --:--:-- 28898
Removing intermediate container 0bdd62ce99a1
 ---> 314f3607c13e
Step 8/9 : WORKDIR "/root"
Removing intermediate container ace10cb3b4dc
 ---> 8f2848d0a029
Step 9/9 : ENTRYPOINT ["/usr/local/bin/kube-router"]
 ---> Running in 5951c388dc8c
Removing intermediate container 5951c388dc8c
 ---> a4c1171c648c
Successfully built a4c1171c648c
Successfully tagged cloudnativelabs/kube-router-git:jjo-add-arm-archs
Finished kube-router container image build.
  • make container GOARCH=arm
$ make container GOARCH=arm
Building for GOARCH=arm
Checking for QEMU_RUNTIME=/usr/bin/qemu-arm-static ...
Starting kube-router binary build.
GOARCH=arm CGO_ENABLED=0 go build -ldflags '-X github.com/cloudnativelabs/kube-router/app.version=v0.1.0-rc2-8-g5f3bd82 -X github.com/cloudnativelabs/kube-router/app.buildDate=2018-03-12' -o kube-router kube-router.go
Finished kube-router binary build.
docker run -v /home/jjo/work/src/github.com/cloudnativelabs/kube-router:/pwd golang:alpine \
    sh -c ' \
    apk add -U git && \
    ln -s /pwd/vendor /go/src && \
    CGO_ENABLED=0 GOARCH=arm go get github.com/osrg/gobgp/gobgp && \
    cp `find /go/bin -type f -name gobgp` /pwd'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libssh2 (1.8.0-r2)
(2/5) Installing libcurl (7.58.0-r1)
(3/5) Installing expat (2.2.5-r0)
(4/5) Installing pcre2 (10.30-r0)
(5/5) Installing git (2.15.0-r1)
Executing busybox-1.27.2-r7.trigger
OK: 19 MiB in 17 packages
Verifying kube-router gobgp for ARCH=ARM ...
Starting kube-router container image build.
docker build -t "cloudnativelabs/kube-router-git:arm-jjo-add-arm-archs" -f Dockerfile.arm.run .
Sending build context to Docker daemon  66.28MB
Step 1/9 : FROM multiarch/alpine:armhf-v3.7
 ---> 488ae6be2bdc
Step 2/9 : COPY kube-router gobgp /usr/local/bin/
 ---> Using cache
 ---> 3ff2c6059c40
Step 3/9 : COPY build/image-assets/bashrc /root/.bashrc
 ---> Using cache
 ---> 6432bab4fbbf
Step 4/9 : COPY build/image-assets/profile /root/.profile
 ---> Using cache
 ---> d1a87ac0423d
Step 5/9 : COPY build/image-assets/vimrc /root/.vimrc
 ---> Using cache
 ---> 86c652ffaf37
Step 6/9 : COPY build/image-assets/motd-kube-router.sh /etc/motd-kube-router.sh
 ---> Using cache
 ---> 665d9f2cc916
Step 7/9 : RUN apk add --no-cache       iptables       ipset       iproute2       ipvsadm       conntrack-tools       curl       bash &&     mkdir -p /var/lib/gobgp &&     mkdir -p /usr/local/share/bash-completion &&     curl -L -o /usr/local/share/bash-completion/bash-completion         https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion &&     cd &&     /usr/local/bin/gobgp --gen-cmpl --bash-cmpl-file /var/lib/gobgp/gobgp-completion.bash
 ---> Using cache
 ---> 9b92bd1e4faa
Step 8/9 : WORKDIR "/root"
 ---> Using cache
 ---> a1c0c90dc0d8
Step 9/9 : ENTRYPOINT ["/usr/local/bin/kube-router"]
 ---> Using cache
 ---> 0ce46c6635bc
Successfully built 0ce46c6635bc
Successfully tagged cloudnativelabs/kube-router-git:arm-jjo-add-arm-archs
Finished kube-router container image build.
  • make container GOARCH=arm64
$ make container GOARCH=arm64
Building for GOARCH=arm64
Checking for QEMU_RUNTIME=/usr/bin/qemu-aarch64-static ...
Starting kube-router binary build.
GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/cloudnativelabs/kube-router/app.version=v0.1.0-rc2-9-g1b042c8 -X github.com/cloudnativelabs/kube-router/app.buildDate=2018-03-12' -o kube-router kube-router.go
Finished kube-router binary build.
docker run -v /home/jjo/work/src/github.com/cloudnativelabs/kube-router:/pwd golang:alpine \
    sh -c ' \
    apk add -U git && \
    ln -s /pwd/vendor /go/src && \
    CGO_ENABLED=0 GOARCH=arm64 go get github.com/osrg/gobgp/gobgp && \
    cp `find /go/bin -type f -name gobgp` /pwd'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libssh2 (1.8.0-r2)
(2/5) Installing libcurl (7.58.0-r1)
(3/5) Installing expat (2.2.5-r0)
(4/5) Installing pcre2 (10.30-r0)
(5/5) Installing git (2.15.0-r1)
Executing busybox-1.27.2-r7.trigger
OK: 19 MiB in 17 packages
Verifying kube-router gobgp for ARCH=ARM aarch64 ...
Starting kube-router container image build.
docker build -t "cloudnativelabs/kube-router-git:arm64-jjo-add-arm-archs" -f Dockerfile.arm64.run .
Sending build context to Docker daemon  73.03MB
Step 1/9 : FROM multiarch/alpine:aarch64-v3.7
 ---> 5256b638c117
Step 2/9 : COPY kube-router gobgp /usr/local/bin/
 ---> 7b0938826e31
Step 3/9 : COPY build/image-assets/bashrc /root/.bashrc
 ---> fbb5ed3b2de9
Step 4/9 : COPY build/image-assets/profile /root/.profile
 ---> 6c0cb93b2d00
Step 5/9 : COPY build/image-assets/vimrc /root/.vimrc
 ---> f2c2d8a91b7a
Step 6/9 : COPY build/image-assets/motd-kube-router.sh /etc/motd-kube-router.sh
 ---> 2d70aa0b83ac
Step 7/9 : RUN apk add --no-cache       iptables       ipset       iproute2       ipvsadm       conntrack-tools       curl       bash &&     mkdir -p /var/lib/gobgp &&     mkdir -p /usr/local/share/bash-completion &&     curl -L -o /usr/local/share/bash-completion/bash-completion         https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion &&     cd &&     /usr/local/bin/gobgp --gen-cmpl --bash-cmpl-file /var/lib/gobgp/gobgp-completion.bash
 ---> Running in e33624d45a3c
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/aarch64/APKINDEX.tar.gz
(1/26) Installing pkgconf (1.3.10-r0)
(2/26) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(3/26) Installing ncurses-terminfo (6.0_p20171125-r0)
(4/26) Installing ncurses-libs (6.0_p20171125-r0)
(5/26) Installing readline (7.0.003-r0)
(6/26) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(7/26) Installing libmnl (1.0.4-r0)
(8/26) Installing libnfnetlink (1.0.1-r1)
(9/26) Installing libnetfilter_conntrack (1.0.6-r0)
(10/26) Installing libnetfilter_cthelper (1.0.0-r0)
(11/26) Installing libnetfilter_cttimeout (1.0.0-r0)
(12/26) Installing libnetfilter_queue (1.0.2-r0)
(13/26) Installing conntrack-tools (1.4.4-r0)
(14/26) Installing ca-certificates (20171114-r0)
(15/26) Installing libssh2 (1.8.0-r2)
(16/26) Installing libcurl (7.58.0-r1)
(17/26) Installing curl (7.58.0-r1)
(18/26) Installing libelf (0.8.13-r3)
(19/26) Installing jansson (2.10-r0)
(20/26) Installing libnftnl-libs (1.0.8-r1)
(21/26) Installing iptables (1.6.1-r1)
(22/26) Installing iproute2 (4.13.0-r0)
Executing iproute2-4.13.0-r0.post-install
(23/26) Installing ipset (6.34-r0)
(24/26) Installing libnl (1.1.4-r0)
(25/26) Installing popt (1.16-r7)
(26/26) Installing ipvsadm (1.29-r0)
Executing busybox-1.27.2-r8.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 22 MiB in 42 packages
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72448  100 72448    0     0  12096      0  0:00:05  0:00:05 --:--:-- 20914
Removing intermediate container e33624d45a3c
 ---> ccb1b7cd2892
Step 8/9 : WORKDIR "/root"
Removing intermediate container a5e985dac691
 ---> f8a5fc41bac0
Step 9/9 : ENTRYPOINT ["/usr/local/bin/kube-router"]
 ---> Running in a26ad63950da
Removing intermediate container a26ad63950da
 ---> 540eb259f1c1
Successfully built 540eb259f1c1
Successfully tagged cloudnativelabs/kube-router-git:arm64-jjo-add-arm-archs
Finished kube-router container image build.

@murali-reddy
Copy link
Member

Thanks @jjo and good to see you here.

@murali-reddy murali-reddy merged commit c7ce398 into cloudnativelabs:master Mar 14, 2018
@runningman84
Copy link

@jjo can you please add the latest vesrion of kube router into your docker build?

@jjo
Copy link
Contributor Author

jjo commented Dec 4, 2018

@jjo can you please add the latest vesrion of kube router into your docker build?

thanks @runningman84 for the headsup, built and pushed:
xjjo/kube-router:arm-v0.2.3
xjjo/kube-router:arm64-v0.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants