diff --git a/.github/workflows/wheel_image.yml b/.github/workflows/wheel_image.yml new file mode 100644 index 0000000000..3d2a097dd2 --- /dev/null +++ b/.github/workflows/wheel_image.yml @@ -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 }} diff --git a/packaging/python/Dockerfile b/packaging/python/Dockerfile index 36c7d0ad4f..95931335cc 100644 --- a/packaging/python/Dockerfile +++ b/packaging/python/Dockerfile @@ -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