beehive icon indicating copy to clipboard operation
beehive copied to clipboard

Publish arm docker container as well as amd64

Open cerebrate opened this issue 4 years ago • 12 comments

Should hopefully be simple enough; it builds just fine using the existing Dockerfile (to https://hub.docker.com/repository/docker/cerebrate/beehive , for example), but it would be good to have an official image that keeps pace with releases.

cerebrate avatar May 29 '20 14:05 cerebrate

+1 to this request. I would be happy to contribute to getting this integrated in the release script as well.

A few observations,

  • I could not find docker build or docker push inside either tools/release.sh or travis ci or the goreleaser files
  • I assume, https://hub.docker.com/r/fribbledom/beehive, is now being pushed to manually by @muesli
  • Maybe, we could try the following: https://medium.com/@quentin.mcgaw/cross-architecture-docker-builds-with-travis-ci-arm-s390x-etc-8f754e20aaef via travis with on.tags: true
  • Although, to keep it simple, I think locally as well, the same could be done if who ever is doing the release can run the following. (this could also be added to release.sh)
docker buildx build \
     --progress plain \
    --platform=linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x \
    -t $DOCKER_REPO:$TAG \
    --push \
    .

rhnvrm avatar Jun 14 '20 02:06 rhnvrm

* I assume, https://hub.docker.com/r/fribbledom/beehive, is now being pushed to manually by @muesli

Correct, I'm currently running docker build and push manually after pushing a new release.

* Maybe, we could try the following: https://medium.com/@quentin.mcgaw/cross-architecture-docker-builds-with-travis-ci-arm-s390x-etc-8f754e20aaef via travis with `on.tags: true`

I'm currently trying to move away from TravisCI, which sadly has become just too unreliable. We could achieve something similar with GitHub Actions, of course, but I think ideally we integrate this with goreleaser. Contributions are more than welcome here! :heart:

muesli avatar Jun 14 '20 02:06 muesli

Hey

I'm not familiar with Github Actions but I've attempted to add the docker buildx step to release.sh here: https://github.com/rhnvrm/beehive/commit/84725cb4167f86f7adc2ce17e0519a5b93f51369

I was able to push to docker hub with multiple archs: https://hub.docker.com/r/rhnvrm/beehive/tags

For setting up buildx with multi arch you will need to do the following locally:

  1. Add {"experimental":"enabled"} to /etc/docker/daemon.json and $HOME/.docker/config.json and restart docker sudo service docker start
  2. Enable multi-arch builder
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name xbuilder --use

If you think this is enough, I can send a PR.

rhnvrm avatar Jun 14 '20 04:06 rhnvrm

Found this recently,

https://github.com/crazy-max/ghaction-docker-buildx

Should we try adding this?

rhnvrm avatar Aug 14 '20 14:08 rhnvrm

@rhnvrm Haven't tried docker-buildx before, but sounds intriguing. Isn't offering Docker Hub a similar integration, though? I'll have to read up on that.

muesli avatar Aug 17 '20 09:08 muesli

Hey, just read a bit more about this. Docker Hub also seems to provide it with pre/post hooks.

This repo shows how it can be done:

https://github.com/ckulka/docker-multi-arch-example https://hub.docker.com/r/ckulka/multi-arch-example

It seems to rely on https://github.com/estesp/manifest-tool

Both methods have their merits.

One benefit, of setting up using buildx, might be that we can have a relatively easier way to build and push from local (if needed).

rhnvrm avatar Aug 19 '20 04:08 rhnvrm

Another option would be using the already existing goreleaser setup (see .goreleaser.yml) to publish Docker builds. That would actually heavily improve and simplify the entire release process.

muesli avatar Aug 19 '20 12:08 muesli

I had explored this option as well but landed on https://github.com/goreleaser/goreleaser/issues/530

rhnvrm avatar Aug 19 '20 13:08 rhnvrm

Hello, Any news on this? would love to have a play, but only have pis at home

mhzawadi avatar Oct 01 '20 06:10 mhzawadi

It seems like the docker-buildx repo I had linked earlier has been moved under docker organization

https://github.com/docker/setup-buildx-action

I can give it a try with a new PR. What do you say @muesli ?

rhnvrm avatar Oct 01 '20 08:10 rhnvrm

@rhnvrm Yeah, go ahead :heart: Since goreleaser support is still WIP I'd say we should explore this route.

muesli avatar Oct 01 '20 09:10 muesli

@muesli I have updated #323

For testing, I created a dummy tag and pushed it in my fork: https://hub.docker.com/repository/docker/rhnvrm/beehive/tags?page=1

After merging, any tag pushed will be pushed to your dockerhub.

Two secrets will need to be set up:

DOCKERHUB_USERNAME
DOCKERHUB_TOKEN

rhnvrm avatar Nov 06 '20 15:11 rhnvrm