Skip to content

Conversation

buchdag
Copy link
Member

@buchdag buchdag commented Jun 4, 2018

https://docs.docker.com/develop/develop-images/multistage-build/

This Dockerfile does not fetch a pre built binary of docker-gen like the current one but compile it from source during the first stage, then grab the compiled binary for the final image from this stage.

This allows to build the image on any arch the golang and alpine images are available for from a single Dockerfile.

Tested and working on arm 32 bits arch (Raspbian running on a Raspberry Pi 3).

I feel this is a cleaner and more flexible solution than the usual method of maintaining a different Dockerfile for each arch (as proposed in #372). The drawbacks are:

  • requires Docker 17.05+ to build
  • the intermediate stage containers have to be manually cleaned

This allows to build for any arch
Credits to @wiget for the idea
@buchdag buchdag requested a review from JrCs June 4, 2018 12:50
@wiget
Copy link

wiget commented Jun 4, 2018

Thanks @buchdag for upstreaming this idea. I tested this on HypriotOS/aarch64 on Raspberry Pi 3 B+

@buchdag buchdag merged commit 9d8f112 into nginx-proxy:master Jun 5, 2018
@buchdag buchdag deleted the multi-stage-build branch June 5, 2018 07:37
This was referenced Jun 5, 2018
@rriemann
Copy link

rriemann commented Jan 5, 2019

@buchdag , do you maintain a fork we can use until your changes are merged?

@buchdag
Copy link
Member Author

buchdag commented Jan 5, 2019

This PR has already been merged 7 months ago :)

@rriemann
Copy link

rriemann commented Jan 5, 2019

@buchdag , oh my bad - that's true.

Anyway, I still run into a problem when I have the companion as a dependency of Nextcloud on an Scaleway ARM server. I use this docker-compose file: https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/postgres/fpm/docker-compose.yml

The composer log suggests that arm is not supported:

standard_init_linux.go:190: exec user process caused "exec format error"

@buchdag
Copy link
Member Author

buchdag commented Jan 5, 2019

Do you build the image from sources on the Scaleway ARM server ?

@rriemann
Copy link

rriemann commented Jan 5, 2019

I just called docker-compose build --push and docker-compose up -d.

@buchdag
Copy link
Member Author

buchdag commented Jan 5, 2019

The goal of this PR was to allow building the image from the Dockerfile on any arch, not providing multi arch image straight from Dockerhub. The image you pull from Dockerhub is still amd64 only.

Clone the repo on your Scaleway server and build the image from it. It does not work with docker-compose build but with docker build -t jrcs/letsencrypt-nginx-proxy-companion . from inside the cloned repo (BTW I'm not aware of any --push flag to docker-compose build).

bingozb pushed a commit to bingozb/docker-letsencrypt-nginx-proxy-companion that referenced this pull request Dec 4, 2019
Allows to build for any arch
Credits to @wiget for the idea
@buchdag buchdag added the scope/arm Issue / PR related to arm architectures label Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope/arm Issue / PR related to arm architectures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants