Skip to content

Add CI action for uploading Docker image for wheels #3268

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

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Dec 4, 2024

The images on https://hub.docker.com/r/neuronsimulator/neuron_wheel/tags are a bit inconsistent; we should use one tag for all platforms (since Docker picks the right one based on the architecture when pulling, no need to have separate tags). They are also a bit of a pain to update: someone (with push permissions!) needs to build the image on their own machine, for both x86_64 and aarch64, tag them correctly, and then upload them to DockerHub. This whole process is a bit error-prone and can take a while.

This CI introduces a manual action that can be run (ran?) to automatically build the neuronsimulator/neuron_wheel image for both x86 and aarch64, and optionally pushes it to DockerHub (by setting upload to true).

Note that DOCKERHUB_USERNAME needs to be set as an env variable for this repo, and DOCKERHUB_TOKEN needs to be set as an env secret for pushing to work.

Once this is merged, and this action is ran at least once, I can make another PR which introduces the necessary changes to use a unified neuronsimulator/neuron_wheel:latest image everywhere.

EDIT: after spending some time fiddling with it, docker buildx is a bit cumbersome to use locally, so in the interest of simplicity, the tags should be x86_64 and aarch64 (to match the outputs of uname -m).

@JCGoran JCGoran force-pushed the jelic/ci_docker_base_image branch from 8f6ba67 to 0e6433d Compare December 4, 2024 10:51
@JCGoran JCGoran requested review from nrnhines and heerener December 4, 2024 11:08
@JCGoran JCGoran marked this pull request as ready for review December 4, 2024 11:11
@JCGoran JCGoran mentioned this pull request Dec 4, 2024
2 tasks
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.08%. Comparing base (ca6e145) to head (352dd48).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3268   +/-   ##
=======================================
  Coverage   67.08%   67.08%           
=======================================
  Files         571      571           
  Lines      111039   111039           
=======================================
  Hits        74485    74485           
  Misses      36554    36554           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 0e6433d -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 1904ec2 -> Azure artifacts URL

Copy link

✔️ dcc62f8 -> Azure artifacts URL

Copy link

✔️ 0e3c6a7 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ de6cb90 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@JCGoran
Copy link
Collaborator Author

JCGoran commented Dec 9, 2024

It turns out that the action is very slow to build the aarch64 image since it's using emulation instead of a native runner, so I for now it's easier and faster to just build things locally, and push to dockerhub/GHCR. Native Linux arm runners are on the way, but only in early 2025, so I'll leave this unmerged for now.

Remove Python 3.13t (the free-threaded build) as we do not support it
yet.
Copy link

Copy link

✔️ c5429d6 -> Azure artifacts URL

@JCGoran JCGoran added the CI Continuous Integration label Jan 9, 2025
@JCGoran JCGoran marked this pull request as draft January 15, 2025 12:31
@JCGoran
Copy link
Collaborator Author

JCGoran commented Jan 20, 2025

An update on this: GitHub released ARM runners recently 🎉 https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/
I tried building the base image with those, and it turns out they are actually faster to build than the x86_64 one (12 minutes vs. 17 minutes, see for instance https://github.com/neuronsimulator/nrn/actions/runs/12870048372)!

Note that, with this recent update, we could in principle move all of our CI infrastructure to GitHub (if this is desired).

Copy link

✔️ 7d5e83a -> Azure artifacts URL


container_registry:
description: 'The name of the container registry to upload the image to (only useful if used with upload=true)'
default: 'ghcr.io'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: need to specify auth token.


tag:
description: 'The tag for the final Docker image'
default: 'latest-'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In light of #3306, the new images have the tag manylinux_2_28, so maybe this needs some rethinking.

Copy link

Copy link

✔️ 352dd48 -> Azure artifacts URL

@JCGoran
Copy link
Collaborator Author

JCGoran commented Jun 4, 2025

The way this would ideally work is as follows:

  • user changes packaging/python/Dockerfile (or some other fixed path that requires building containers)
  • upon opening a PR, a CI job is launched that builds a container with a temporary tag (for instance, with the PR number), and uploads it to ghcr.io
  • if the container builds successfully, the job responsible for building NEURON wheels on Linux (or any other job requiring containers) is launched
  • once the PR is merged, the CI job that built the container is re-launched, but this time, it tags it with whatever is the "official" tag (currently, those are manylinux_2_28_x86_64 and manylinux_2_28_aarch64), and pushes it to docker.io. Optionally, the temporary-tagged container is deleted to save space
  • once the above is done, the job in charge of building wheels (or other jobs requiring containers) is launched

Unfortunately, all of this is rather complex to set-up (also has security implications due to DockerHub not allowing auth tokens for orgs, and scoped ones at that), and having the split between Azure and GitHub Actions is not helping, so I'm kind of leaving this in the "nice idea, but complex implementation" bucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants