Build custom Docker image for manylinux wheels #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: 'linux/amd64' | |
arch: 'x86_64' | |
- platform: 'linux/arm64' | |
arch: 'aarch64' | |
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: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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 }}-${{ matrix.arch }} | |
build-args: | | |
MANYLINUX_IMAGE=${{ github.event.inputs.base_image }}_${{ matrix.arch }} |