Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Include Release & Docker build for Raspberry Pi (ARMv6/7 Architecture) #16

Closed
shbatm opened this issue Jan 15, 2019 · 13 comments · Fixed by #35 or #39
Closed

[Request] Include Release & Docker build for Raspberry Pi (ARMv6/7 Architecture) #16

shbatm opened this issue Jan 15, 2019 · 13 comments · Fixed by #35 or #39

Comments

@shbatm
Copy link

shbatm commented Jan 15, 2019

Not a bug. This is a general feature request to include an Arm version of the Docker build (via Travis-CI).

I was able to build the image myself successfully using the steps in this Gist (leaving here for anyone else who might want to reference), but it would be nice to have a pre-built Docker image for running on a Raspberry Pi.

Thanks!

@shbatm shbatm changed the title [Request] Include Release Docker build for Raspberry Pi (ARMv6/7 Architecture) [Request] Include Release & Docker build for Raspberry Pi (ARMv6/7 Architecture) Jan 15, 2019
@JoelSpeed
Copy link
Member

Totally in agreement, we should add this. If anyone wants to pick this up feel free!

@kfox1111
Copy link

v8 too please. I've switched almost entirely to aarch64.

@Sheshagiri
Copy link

I'm in for this. Let me know.

@karlskewes
Copy link
Contributor

I've added the armv6 and arm64 build lines to the Makefile and the resulting binaries work on the different platforms (I have RPi and Rock64 SBC's) (at least oauth2_proxy --version).

Building arm or arm64 images on an amd64 host is slightly more complicated as the build machine needs to have qemu-user-static to cross compile if we follow someone like Flannel's build process.
Then we need to extend the Makefile and Dockerfile's (Dockerfile.{amd64|armv6|arm64}) out with all this.

An alternative is GoReleaser which seems to produce multiple docker images for each arch easily and should require the same build steps no matter what arch the building host is. goreleaser --snapshot --rm-dist or similar.
I've just recently used GoReleaser for something else.

I'd like to run oauth2_proxy on my multi-arch kubernetes cluster so I can have a go at a PR depending on what way we want to go.

@JoelSpeed
Copy link
Member

I'd personally be tempted to go for the Flannel approach and have separate Dockerfiles for the arm builds.

I'd be tempted to leave the amd64 Dockerfile just as Dockerfile as this is likely to be the most frequently used Dockerfile, do we think that would confuse people?

What was the reason for choosing armv6? I understand arm versions have some backwards compatibility but I'm not an arm user myself. I notice that Kubernetes use armv7 for their arm releases

@karlskewes
Copy link
Contributor

I couldn't comment whether it's better to build for v7 or v6.
Golang download has armv6 but not armv7 - https://golang.org/dl/

Sounds good to leave amd64 Dockerfile as is.
If we end up being able to do multi-arch docker images then we can duplicate the Dockerfile with extension at that point.
I can PR the binary Makefile changes as that is straight forward?
Docker as stage 2?

Docker image building:

  1. Building by users "on arm" - docker build -f Dockerfile.arm64 .
    Our current Dockerfile relies on golang/dep however that project doesn't build arm/arm64 binaries - dep releases.
    There is this issue for adding support for arm.
    It looks like it might be possible to extend to arm with a one liner change in dep's Makefile
    Investigating this now.
    I've built dep binary for arm and am going through seeing if I can then build oauth2_proxy with it.
    It may dictate whether we build armv6 or armv7.

  2. Building by users "on amd64" or for releases.
    This is where the qemu process will come in.

@kfox1111
Copy link

As far as I know, only the rpi zero and origional rpi are armv6 and pretty much everything else is v7 these days.

@karlskewes
Copy link
Contributor

Thanks for merging binaries!

Do we want to keep this issue open for tracking the second part; arm docker images?
I'm tempted to wait and see what happens with the dep PR linked above before doing any more work with Dockerfiles though.

@JoelSpeed JoelSpeed reopened this Jan 31, 2019
@JoelSpeed
Copy link
Member

So I don't think the dep thing is a problem.

The Dockerfiles we want in the repo are for building releases and pushing to Quay right? People won't be building Dockerfiles on their arm machines

So given we use multi stage builds, we can make our first stage of that amd64 (as it is now) and then just copy the arm binary into an arm based base image for distribution

Have I missed something?

@karlskewes
Copy link
Contributor

Okay.
Yeah I agree it's probably a bit of an oddball case to build docker images on arm platform. Most people will have access to amd64 to build if they want/need.
Building on arm is only blocked by my dep PR which is a minor patch that a motivated person could apply in any case.
Leaving this out of scope for now might be an option?
Anyone else in this thread wish to comment?

Regarding your suggestion about copying in an arm binary, I tried just that by modifying a Dockerfile and building on my amd64 laptop however the end Docker image ends up showing arch: amd64 in the manifest when you inspect it.

$ docker inspect bitnami-labs/sealed-secrets-controller:arm64-latest | grep Arch
        "Architecture": "amd64",

If try setting the second image to FROM arm32v6/alpine:3.8 then I think the apk add stage or general container start fails.
The failure message is not very helpful but web search suggests it's an ELF issue.
This led me to dep and qemu and contrasts with my experience with GoReleaser which magically creates all the different arch images somehow.

So.... I will have a go at the qemu stuff to get us building arm docker images on amd64. :)

@kfox1111
Copy link

Have a look at this pr that the helm folks are working on. I think its based on how k8s cross compiles and builds the images:
helm/helm#5039

It might be helpful.

@karlskewes
Copy link
Contributor

Thanks for the link, matches my recent learnings. Similar approach to flannel. Will have a go at it soon.

@JoelSpeed
Copy link
Member

I think this can be closed by #39, can those interested double check?

@JoelSpeed JoelSpeed mentioned this issue Feb 6, 2019
3 tasks
@JoelSpeed JoelSpeed self-assigned this Feb 6, 2019
lhauspie pushed a commit to lhauspie/dep that referenced this issue Apr 9, 2019
On path to close golang#1807 on [oauth2_proxy arm support](oauth2-proxy/oauth2-proxy#16)

Tested:
- Building armv6 and arm64 binaries on amd64
- Running arm binaries
- Using armv6 binary on RPi 3B to build another project [oauth2_proxy](https://github.com/kskewes/oauth2_proxy/tree/build)
  (`dep ensure`)

Not verified:
- Install script completes as binaries not published, looks okay
though.
- `hack/test.bash` - must have missed something.

armv6 (RPi 3B):
```
karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ dep version
dep:
 version     : v0.5.0-31-g73b3afef-dirty
 build date  : 2019-02-01
 git hash    : 73b3afe
 go version  : go1.11.5
 go compiler : gc
 platform    : linux/arm
 features    : ImportDuringSolve=false

karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ make dep
dep ensure --vendor-only

karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ uname -m
armv7l

karl@pi1:~ $ ./install.sh
ARCH = arm
OS = linux
Will install into /home/karl/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm..
Request failed with code 404

karl@pi1:~ $ ./test.bash
go test: -race is only supported on linux/amd64, linux/ppc64le, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
```

arm64 (Rock64):
```
rock64@k8s-w-01:~$ ./dep-linux-arm64 version
dep:
 version     : v0.5.0-31-g73b3afef-dirty
 build date  : 2019-02-01
 git hash    : 73b3afe
 go version  : go1.11.5
 go compiler : gc
 platform    : linux/arm64
 features    : ImportDuringSolve=false

rock64@k8s-w-01:~$ uname -m
aarch64

rock64@k8s-w-01:~$ ./install.sh
ARCH = arm64
OS = linux
Will install into /home/rock64/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm64..
Request failed with code 404
```
michael-freidgeim-webjet pushed a commit to MNF/oauth2-proxy that referenced this issue Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants