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
Draft
72 changes: 72 additions & 0 deletions .github/workflows/wheel_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build custom Docker image for manylinux wheels

on:
workflow_dispatch:
inputs:
base_image:
description: 'The base Docker image to use'
default: 'manylinux_2_28'
type: choice
options:
- 'manylinux2014'
- 'manylinux_2_28'
- 'manylinux_2_34'

upload:
description: 'Whether to upload (push) the image to the container registry'
default: 'false'
required: true
type: 'boolean'

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.

required: true
options:
- 'ghcr.io'
- 'docker.io'

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.

required: true

jobs:
docker:
name: 'Create Docker image for manylinux wheels'
runs-on: ${{ matrix.base_image }}
strategy:
matrix:
include:
- platform: 'linux/amd64'
arch: 'x86_64'
base_image: 'ubuntu-22.04'
- platform: 'linux/arm64'
arch: 'aarch64'
base_image: 'ubuntu-22.04-arm'

steps:
- name: Login to Docker Hub
if: github.event.inputs.upload == 'true' && github.event.inputs.container_registry == 'docker.io'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub container registry
if: github.event.inputs.upload == 'true' && github.event.inputs.container_registry == 'ghcr.io'
uses: docker/login-action@v3
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:packaging/python"
platforms: ${{ matrix.platform }}
push: ${{ github.event.inputs.upload }}
tags: ${{ github.event.inputs.container_registry }}/neuronsimulator/neuron_wheel:${{ github.event.inputs.tag }}${{ github.event.inputs.base_image }}_${{ matrix.arch }}
build-args: |
MANYLINUX_IMAGE=${{ github.event.inputs.base_image }}_${{ matrix.arch }}
Loading