-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Create CI to build & push PyBaMM's Docker Images #3316
Conversation
Related to #3312 |
I'd also need help with setting up the docker secrets for this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would building and pushing images in their separate jobs be a better way, rather than in a series of steps?
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3316 +/- ##
========================================
Coverage 99.58% 99.58%
========================================
Files 256 256
Lines 19998 19998
========================================
Hits 19915 19915
Misses 83 83 ☔ View full report in Codecov by Sentry. |
Can they run parallelly in case of separate jobs? I'd be happy to switch to separate jobs either way though 🙂 |
Yes, they will run and upload images in parallel. We would need to check out the repository in each job, however. Since it would be developers who would be using the image, could you remove the sparse checkout and let it fetch the entire commit depth of the repository? |
Actually, multiple jobs might not be needed in this case, a matrix for the solver arguments should suffice after the check out step |
Do you want us to add them in the GitHub repo or do you want us to generate it from Dockerhub? |
I'd need help with adding them to github repo, i can generate & send secrets to you on slack. |
Note: to push to Docker Hub we should use https://github.com/docker/build-push-action. I noticed that they have some examples about setting up QEMU, we should be able to build both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @arjxn-py! Looks great! Should be ready to merge once the comment below is resolved -
Also, taking into consideration that we would further be pushing images on release candidates, releases, and possibly nightly releases too (not in this PR): I was wondering about storage limits on Docker Hub. @arjxn-py do you know if there are any? If so, we could push just the "All solvers" image because the other images would then be redundant, and document this change in the Docker installation page. If someone wants to build an image with a specific solver locally, we already have instructions on how to do that |
As of my knowledge & research there's no storage limit for images on DockerHub (i.e. we can have as many tags we want) however there's an individual image size limit which we don't have to bother about as our image size is smaller. |
That's great, thanks for the info! Pushing all images should be fine then |
Co-authored-by: Saransh Chopra <[email protected]>
- name: Build and Push Docker Image (With All Solvers) | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: scripts/Dockerfile | ||
tags: pybamm/pybamm:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we did not tag the images properly. On https://hub.docker.com/r/pybamm/pybamm/tags I can see that this image was pushed with the latest
tag, and
- name: List built images | ||
run: docker images | ||
|
||
- name: Build and Push Docker Image (Without Solvers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one also has the latest
tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the earlier one (with all solvers) should have had the all
tag. I do have a local branch which fixes things up a bit for this workflow (including logging in and uploading these images in parallel jobs) and will write a PR soon, I might look into adding the multi-platform images there itself.
pybamm-team#3316 fix discrepancy with tagging the images, add a step to append tags to GitHub output, add support for multi-architecture images by setting up QEMU.
Description
This PR aims to create a CI that builds all PyBaMM's docker images & then pushes them to DockerHub.
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: