Skip to content
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

Build and push images with Github Actions to DockerHub #68

Merged
merged 5 commits into from Jun 21, 2021

Conversation

jacksgt
Copy link
Collaborator

@jacksgt jacksgt commented Jun 18, 2021

Build and push (5.x) images with Github Actions to DockerHub.
4.x and 3.x images can be added by creating another workflow for them.
Also, as the comments indicate, the images can easily be pushed to both DockerHub and GHCR (from the same build).

References:

Note: docker / buildx does not support '+' in the image tag name.

invalid tag "martialblog/limesurvey:0.0.0+test5-apache": invalid
reference format

Use underscores instead, like the images already have on Dockerhub

@jacksgt
Copy link
Collaborator Author

jacksgt commented Jun 18, 2021

@martialblog Please add your DockerHub username and password as "secrets" to the Github repository. Then you can test the "Login to DockerHub" step and enable the "push: true" option. Feel free to push directly on this branch.

@martialblog
Copy link
Owner

@jacksgt 🥇 MVP Award

I just added an access token as env secret. Not sure about the namespace yet, haven't workend too much with GitHub Actions. We can change that later.

@martialblog martialblog added the enhancement New feature or request label Jun 18, 2021
@martialblog
Copy link
Owner

The 3.* is LTS so we need that. 4.* is replaces by 5.* completely as far as I known

@martialblog
Copy link
Owner

What I currently imagine for the CI is this:

  • hadolint runs on all branches/PR
  • Images are build on all branches/PR
  • Container structure tests on all branches/PR
  • Trivy Scan on Tags (report as artifact)
  • Push on Tags

@jacksgt
Copy link
Collaborator Author

jacksgt commented Jun 19, 2021

What I currently imagine for the CI is this:

* hadolint runs on all branches/PR

* Images are build on all branches/PR

* Container structure tests on all branches/PR

* Trivy Scan on Tags (report as artifact)

* Push on Tags

Yes, I think that sounds good and feasible.
This could also utilize an external build cache for the image build, see docker-build action.
We should create a new issue for that, such that we don't have too much scope-creep in this PR.

@jacksgt jacksgt temporarily deployed to docker-build June 19, 2021 17:32 Inactive
References:
* https://docs.github.com/en/actions/guides/publishing-docker-images
* https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md
* https://github.com/docker/metadata-action

Note: docker / buildx does not support '+' in the image tag name.
> invalid tag "martialblog/limesurvey:0.0.0+test5-apache": invalid
reference format

Use underscores instead, like the images already have on Dockerhub.
@jacksgt jacksgt changed the title [wip] Build and push images with Github Actions to DockerHub Build and push images with Github Actions to DockerHub Jun 19, 2021
@jacksgt
Copy link
Collaborator Author

jacksgt commented Jun 19, 2021

Okay, I think we are ready to go here. I squashed the commits and cleaned up the TODOs.
@martialblog are you fine with creating a '5.0.3+210609_test' tag to perform a complete integration test?
(Until now the images have not been pushed to DockerHub).

@jacksgt jacksgt mentioned this pull request Jun 19, 2021
5 tasks
@martialblog
Copy link
Owner

Yeah sure, we can just delete it afterwards

@martialblog
Copy link
Owner

I agree on the scope-creep, but before we merge... can be set this up so that the build phase and the push phase are two workflows. That way be can plug in the structure-tests and cve-scans later

@martialblog martialblog merged commit 3890f9f into master Jun 21, 2021
@martialblog martialblog deleted the jack/gh-actions branch June 21, 2021 12:09
@jacksgt
Copy link
Collaborator Author

jacksgt commented Jun 21, 2021

Hooraayy!

FYI @martialblog Images will now need to be tagged like 5.0.3-BUILD (note the dash). Docker tags don't support + (which is valid semver) and when you use _ then the metadata GH action step will complain because that's not valid semver ...
So, need to use -.

moby/moby#16304

@martialblog
Copy link
Owner

That's ok, we just need to update the README accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limesurvey 5 images on docker hub?
2 participants