-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Automated multi-platform build and DockerHub publication #8
Conversation
This setup uses GitHub Actions to build an image for arm/v7 and arm64 then publish them on DockerHub (you need to setup repo secrets first) every time you want (workflow_dispatch), every push, every pull requests (pull_requests), or on a schedule (cronjob) :) Remove the triggers you don't want. Reminder: if you ever move the Dockerfile (or some dependencies), you will have to correct the Dockerfile path (and/or the context path).
This checks the dependencies' versions for the Actions everyday and creates a pull request if there are new versions available.
If I understand this correctly, whenever there is a new push or PR merged to the main branch, Github action would package the server image and push it to the specified location on the docker hub, correct? Then in docker-compose, we can use that image instead of building from local if we want to. |
Exactly! I set it up only for armv7 and arm64, but you can test other platforms (list at https://github.com/docker/setup-qemu-action). Instead of doing it on every push or pull, you can also trigger it manually in the Actions tab, or have it done on a cron schedule. You can also pick the repo you want to publish to. I set it up for DockerHub, but you can use all the common ones like Google/GitHub/Amazon/etc More customization options are there: https://github.com/marketplace/actions/build-and-push-docker-images You can also run tests on the image https://github.com/docker/build-push-action/blob/master/docs/advanced/test-before-push.md |
Thank you, merged! |
@alextran1502 I see the action failed because you didn't setup the login correctly. If you want to publish on DockerHub, you need to
The process is similar if you prefer other platforms than DockerHub, although you would need to use a different GitHub Action instead of |
This setup uses GitHub Actions to build an image for arm/v7 and arm64 then publish them on DockerHub (you need to setup repo secrets first) every time you want (workflow_dispatch), every push, every pull requests (pull_requests), or on a schedule (cronjob).
It also checks the dependencies' versions for the Actions everyday and creates a pull request if there are new versions available.
Remove the triggers you don't want :)
Reminder: if you ever move the Dockerfile (or some dependencies), you will have to correct the Dockerfile path (and/or the context path).