-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
Add workflow for docker build and push #750
Add workflow for docker build and push #750
Conversation
Improve naming of jobs
Hey @mgogoulos I have organized the CI jobs to ensure that the software does not get released if it fails the unit tests or linting. For more details, see:
Here you can see the CI output of a project with similar workflow dependency layout. |
Awesome work @Adito5393 , I will review it during this week. Thanks a lot |
Hey @mgogoulos, What is holding this PR to be merged? Is there anything I can help with? At the moment, the only DockerHub tag available is the |
Hi, it has just been a matter of not having enough capacity to test it. But your instructions are very good, so I am now merging it after having created the two secret variables |
Merged, thanks for this! It might require some calibration, as it happens in similar cases where some new workflow is introduced, let's find out! |
@Adito5393 please let me know if you want to help in other issues too. There are devops/infrastructure/dev experience related tickets, as upgrade of all libraries and software, improve the Docker Compose files, provide a clear path for Developmnent etc so it would be great to help there too, or on other issues that interest you more! |
Hey, thanks! I will be available for support for whatever calibration is required. |
By the way, I just noticed that you have Automated Builds setup via DockerHub UI(?!): I recommend disabling it because you only want to build the docker image if your commits/changes pass the tests. This is handled by the new GitHub Action workflow. |
I've disabled it, it was part of DockerHub |
Hi @Adito5393 , I have created a test PR and it fails to complete, see https://github.com/mediacms-io/mediacms/actions/runs/5388845143/jobs/9782101845?pr=823 I've added these two secrets on the settings. Do you have any clues what is happening? Also not sure I understand what this will do, will it push an image to Docker Hub in this case? (this is a PR, it's not merged with master yet) Thanks |
It fails because the secrets are probably disabled in PR. We can modify the job release:
uses: ./.github/workflows/docker-build-push.yml
needs: [test]
if: github.event_name != 'pull_request' I will test it on my fork this evening and let you know if it works. You might also want to skip CI for all files inside the paths-ignore:
- '**/README.md'
- 'docs/**' |
This works, and i also changed on ci.yml to use However, it is still unable to read the repository secrets, and this is very weird :( |
Hm, it was a syntax error... I guess your last commit fixed it a1962d4 EDIT: I was to fast to reply :) |
@mgogoulos, The debug logs clearly show that the secrets are not set:
Could you remove it and try a new token? (force reset it) |
I'm pausing for now but will try out tomorrow again. I did remove it and then added it a couple of times, and I even added it as an organization secret, but on all cases it shows as null on the debug logs. Something strange happening here! |
1fd04ca |
Summary
This PR adds automation to build and deploy the Docker image to Docker Hub through two triggers:
v*.*.*
(see https://semver.org/ for more information)If you prefer to deploy only on tags and not on every branch push, you can remove lines 5 and 6:
Additionally, two secret variables are required in the GitHub settings:
The token can be generated from https://hub.docker.com/settings/security.
Please merge this PR to enjoy the automation.
Testing
I tested this PR by forking the repo and deploying it at https://hub.docker.com/r/adito5393/mediacms/tags.
The development was done on the add-dockerhub-release-with-all-tags branch.
The GitHub Actions output can be viewed at https://github.com/Adito5393/mediacms/actions/workflows/docker-build-push.yml.