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

Add CI action for uploading Docker image for wheels #3268

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
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: 'manylinux2014'
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'
required: true
options:
- 'ghcr.io'
- 'docker.io'

tag:
description: 'The tag for the final Docker image'
default: 'latest-'
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 }}
3 changes: 3 additions & 0 deletions packaging/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,7 @@ COPY Dockerfile .
# build wheels from there
WORKDIR /root

# remove Python 3.13t since we do not support the free-threaded build yet
RUN rm -fr /opt/python/cp313-cp313t

ENV NMODL_PYLIB=/nrnwheel/python/lib/libpython3.10.so.1.0
Loading