|
| 1 | +name: 'Multi-Py Image Builder' |
| 2 | +description: 'Build multiarchitecture builds of your favorite Python libraries.' |
| 3 | + |
| 4 | +inputs: |
| 5 | + |
| 6 | + python_version: |
| 7 | + description: 'The Python version for this container.' |
| 8 | + required: true |
| 9 | + default: '3.10' |
| 10 | + |
| 11 | + target_base: |
| 12 | + description: 'The target version (slim, alpine, or full)' |
| 13 | + required: true |
| 14 | + default: 'full' |
| 15 | + |
| 16 | + package: |
| 17 | + description: 'The primary python package for the container.' |
| 18 | + required: true |
| 19 | + |
| 20 | + package_version: |
| 21 | + description: 'The version to use in this container.' |
| 22 | + required: true |
| 23 | + |
| 24 | + package_latest_version: |
| 25 | + description: 'The latest version of the package. When this matches `package_version` extra tags are added.' |
| 26 | + required: false |
| 27 | + |
| 28 | + image_name: |
| 29 | + description: 'The name of the image (without the registry or tag).' |
| 30 | + required: true |
| 31 | + default: ${{ github.repository }} |
| 32 | + |
| 33 | + platform: |
| 34 | + description: 'The platform string to pass to buildx.' |
| 35 | + required: true |
| 36 | + default: "linux/amd64,linux/arm64,linux/arm/v7" |
| 37 | + |
| 38 | + maintainer: |
| 39 | + description: 'The maintainer, in `Name <email>` format.' |
| 40 | + required: true |
| 41 | + default: ${{ github.repository_owner }} |
| 42 | + |
| 43 | + dockerfile: |
| 44 | + description: "The path to the dockerfile to use while building." |
| 45 | + required: true |
| 46 | + default: "${{ github.action_path }}/dockerfile" |
| 47 | + |
| 48 | + docker_context: |
| 49 | + description: "The context for building the image." |
| 50 | + required: true |
| 51 | + default: "${{ github.workspace }}/" |
| 52 | + |
| 53 | + registry: |
| 54 | + description: "The registry to store the image in." |
| 55 | + required: true |
| 56 | + default: "ghcr.io" |
| 57 | + |
| 58 | + registry_username: |
| 59 | + description: "The username for logging into the registry. For the Github registry the repository owner is typically the username." |
| 60 | + required: true |
| 61 | + default: ${{ github.repository_owner }} |
| 62 | + |
| 63 | + registry_password: |
| 64 | + description: "The password for logging into the registry. For the Github registry the repository owner is typically `secret.GITHUB_TOKEN`." |
| 65 | + required: true |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +runs: |
| 70 | + using: "composite" |
| 71 | + steps: |
| 72 | + |
| 73 | + - name: Set up QEMU |
| 74 | + uses: docker/setup-qemu-action@v1 |
| 75 | + |
| 76 | + - name: Set up Docker Buildx |
| 77 | + id: buildx |
| 78 | + uses: docker/setup-buildx-action@v1 |
| 79 | + |
| 80 | + - name: Log in to the Container registry |
| 81 | + uses: docker/login-action@v1 |
| 82 | + with: |
| 83 | + registry: ${{ inputs.registry }} |
| 84 | + username: ${{ inputs.registry_username }} |
| 85 | + password: ${{ inputs.registry_password }} |
| 86 | + |
| 87 | + - name: Deploy Image |
| 88 | + run: bash ${{ github.action_path }}/scripts/build_and_push.sh |
| 89 | + shell: bash |
| 90 | + env: |
| 91 | + DOCKERFILE_LOCATION: ${{ inputs.dockerfile }} |
| 92 | + DOCKER_CONTEXT: ${{ inputs.docker_context }} |
| 93 | + PYTHON_VERSION: ${{ inputs.python_version }} |
| 94 | + TARGET_BASE: ${{ inputs.target_base }} |
| 95 | + PACKAGE_LIST: ${{ inputs.package_list }} |
| 96 | + PLATFORM: ${{ inputs.platform }} |
| 97 | + PACKAGE: ${{ inputs.package }} |
| 98 | + PACKAGE_VERSION: ${{ inputs.package_version }} |
| 99 | + PACKAGE_LATEST_VERSION: ${{ inputs.package_latest_version }} |
| 100 | + MAINTAINER: ${{ inputs.maintainer }} |
0 commit comments