muesli / beehive

A flexible event/agent & automation system with lots of bees 🐝
GNU Affero General Public License v3.0
6.32k stars 324 forks source link

Publish arm docker container as well as amd64 #314

Open cerebrate opened 4 years ago

cerebrate commented 4 years ago

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.

rhnvrm commented 4 years ago

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

A few observations,

muesli commented 4 years ago
* 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:

rhnvrm commented 4 years ago

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 commented 4 years ago

Found this recently,

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

Should we try adding this?

muesli commented 4 years ago

@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.

rhnvrm commented 4 years ago

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).

muesli commented 4 years ago

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.

rhnvrm commented 4 years ago

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

mhzawadi commented 4 years ago

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

rhnvrm commented 4 years ago

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 ?

muesli commented 4 years ago

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

rhnvrm commented 4 years ago

@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