-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Added a github workflow to automatically build and publish the latest from the main branch to docker hub. #203
base: main
Are you sure you want to change the base?
Conversation
Hm |
So im a bit new to this stuff will this remotly automatically rebuild the docker image every time the repo is updated? or is this just simplifying the build and push command when rebuilding the docker to the latest on my computer locally? |
Cause the Dockerfile build is a bit.... resource and time intensive as it includes a test run to make the base model and such baked into it U know for simplicity when people pull it, makes everything just work, faster |
I feel like if it does it automatically all the time then ill run out of the free github build resources? Or I'm not reading the fine-print correctly on this? 😅 |
It is a sample github workflow (see here for more info: https://www.geeksforgeeks.org/github-workflows/) This workflow: GitHub workflows are a way to automate tasks for your project directly on GitHub. Think of them as a set of instructions that tell GitHub what to do whenever certain things happen, like when you push code or make a pull request. These workflows are part of GitHub Actions, a tool that helps you automate processes like building, testing, or deploying your project. For your open-source project that builds Docker images, workflows can save you a ton of time and effort. Instead of manually building and uploading your Docker images, you can set up a workflow to automatically do that every time you update your code. This ensures your Docker image is always up-to-date and consistent, making it easier for others to use and contribute to your project. Here’s what your workflow is doing:
By automating these steps, your project always has the latest Docker image available, and contributors or users don’t have to build it themselves. This saves time and avoids errors, making your project more efficient and professional. |
.... did you just respond with chatgpt to my hand typed messages to you... |
To answer your questions... However, I wouldn't use this workflow as-is. You likely only want to publish on merges to main, and this is building and publishing on both main and PRs. The latter is a security and reliability risk. If you drop the It also looks like it was written by an LLM that wasn't aware there are newer action versions. |
what's your interest to advertise this kind of tools? |
I use GitHub Actions every day for work. Building and publishing a container image for community use like this is a very common use-case. I would just put some additional functionality on it. Caching. Automatic semver using conventional commits. And maybe split the workflow or use additional image tagging logic to support multiple channels (e.g. latest, stable). There are other actions that help with determining next version, manage metadata and tags, and multi-arch images. I'm a proponent of fully automatic versions and releases with tests/validations on PRs. |
this is not an answer to my question. I ask again, |
I'm not sure I follow, but I'm not interested in advertising anything here. I just happened to be looking at issues and PRs here for an unrelated reason (Apple Silicon problems). Since I use GitHub Actions heavily for personal and work projects, I commented on this PR. |
and if I tell you we prefer to not automate everything? |
It's built into GitHub for free I don't think its advertising 😓 |
@dawilk Sorry about that, The team has just been scarred by a bunch of other people doing advertising in our PR's 😅 Is there a way to make the automated workflow only do a new docker build when we make a new version release? And give it the Version as the docker image tag? If so then I would be VERY interested in an automated docker build. I'm just afraid of making the latest release automated ( Cause sometimes we might make an update that breaks something and I want the dockerImage:latest to be imume to those kind of things 😅 ) |
Just read your message more in depth :) So how would I modify the existing workflow example here to make it do auto-tagging for each and only for the version releases? like I want the automated docker images created with eh version tag for each version we release, But also still be able to have manual control over the |
To make it only release on tags and manual builds, you could set triggers to something like this: on:
push:
tags:
- "[0-9]+.[0-9]+" # change this to list your tag pattern(s)
workflow_dispatch: # this one is for doing manual builds and then the build command that applies tags should account for whether its a manual run or a tag run, and set image tags accordingly. However, you can shortcut manual tag logic in the workflow by using docker/metadata-action. In fact, I would just take a look at the usage section on the metadata action and you may be able to copy-paste their Basic example to meets your needs exactly. Just trim the triggers to the ones mentioned above. I use the docker metadata and build-push actions all the time with more complex tagging strategies as well as pushing to multiple registries (GHCR, ECR, Docker Hub). You can do a lot with them. If you want to be able to change I probably could have just suggested changes on the PR instead of typing all this. 🤔 |
ok guys, open a disccussion to continue this topic. it has nothing to do in the PR section. thanks |
sorry my bad We can continue this conversation at this GitHub discussion here |
Sample github workflow to automatically publish to dockerhub. I suspect you may need to change it to the docker host and repository of choice vs docker hub.
I tested this locally and it works fine.
Here is the output in my repo:
https://github.com/nothingmn/ebook2audiobook/actions/runs/12644758022
Give it a try, via:
docker run -it --rm -p 7860:7860 robchartier/ebook2audiobook
Under the repository settings, secrets and variables, actions, two new repository secrets will need to be created:
DOCKER_USERNAME
DOCKER_PASSWORD
Both with the value from the remote docker repository on your account.
Cheers.