|
| 1 | +name: Build manywheel docker images (custom) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: 'Build with specific tag' |
| 8 | + required: false |
| 9 | + default: '' |
| 10 | + |
| 11 | +jobs: |
| 12 | + check_version: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + version: ${{ steps.check_version.outputs.version }} |
| 16 | + steps: |
| 17 | + - name: Check version |
| 18 | + id: check_version |
| 19 | + run: | |
| 20 | + if [ -z "${{ github.event.inputs.tag }}" ]; then |
| 21 | + echo "No tag provided, using latest release" |
| 22 | + version=$(curl -s "https://api.github.com/repos/opencv/opencv-python/releases/latest" | jq -r .tag_name) |
| 23 | + else |
| 24 | + version=${{ github.event.inputs.tag }} |
| 25 | + fi |
| 26 | +
|
| 27 | + if [ -z "${version}" ] || [ "${version}" == "null" ]; then |
| 28 | + echo "Failed to get version" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +
|
| 32 | + echo "version=${version}" >> $GITHUB_ENV |
| 33 | + echo "version=${version}" >> $GITHUB_OUTPUT |
| 34 | + echo "" |
| 35 | + echo "========== Build Args ==========" |
| 36 | + echo "opencv-python version: ${version}" |
| 37 | +
|
| 38 | + build_loongarch64_manylinux: |
| 39 | + name: Build image for loongarch64 |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: check_version |
| 42 | + env: |
| 43 | + version: ${{ needs.check_version.outputs.version }} |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - uses: docker/setup-qemu-action@v3 |
| 47 | + - uses: docker/setup-buildx-action@v3 |
| 48 | + |
| 49 | + - name: Generate files |
| 50 | + run: | |
| 51 | + mkdir -p docker/manylinux_2_38 |
| 52 | + wget -qO docker/manylinux_2_38/Dockerfile_loongarch64 https://github.com/opencv/opencv-python/raw/refs/tags/${version}/docker/manylinux2014/Dockerfile_x86_64 |
| 53 | + patch -p1 < loong64.patch |
| 54 | + cd docker/manylinux_2_38 |
| 55 | + sed -i "s@FROM quay.io/pypa/manylinux2014_x86_64@FROM ghcr.io/loong64/manylinux_2_38_loongarch64@g" Dockerfile_loongarch64 |
| 56 | + image_tag=$(cat Dockerfile_loongarch64 | grep "Version:" | sed 's/# Version: //') |
| 57 | + echo "image_tag=${image_tag}" >> $GITHUB_ENV |
| 58 | +
|
| 59 | + - name: Login to GitHub Container Registry |
| 60 | + uses: docker/login-action@v3 |
| 61 | + with: |
| 62 | + registry: ghcr.io |
| 63 | + username: ${{ github.repository_owner }} |
| 64 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + |
| 66 | + - name: Build and push image |
| 67 | + uses: docker/build-push-action@v6 |
| 68 | + with: |
| 69 | + context: . |
| 70 | + file: docker/manylinux_2_38/Dockerfile_loongarch64 |
| 71 | + platforms: linux/loong64 |
| 72 | + push: true |
| 73 | + tags: | |
| 74 | + ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux_2_38-loongarch64:${{ env.image_tag }} |
| 75 | +
|
| 76 | + build_ppc64le_manylinux: |
| 77 | + name: Build image for ppc64le |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: check_version |
| 80 | + env: |
| 81 | + version: ${{ needs.check_version.outputs.version }} |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + - uses: docker/setup-qemu-action@v3 |
| 85 | + - uses: docker/setup-buildx-action@v3 |
| 86 | + |
| 87 | + - name: Generate files |
| 88 | + run: | |
| 89 | + mkdir -p docker/manylinux2014 |
| 90 | + wget -qO docker/manylinux2014/Dockerfile_ppc64le https://github.com/opencv/opencv-python/raw/refs/tags/${version}/docker/manylinux2014/Dockerfile_x86_64 |
| 91 | + cd docker/manylinux2014 |
| 92 | + sed -i "s@FROM quay.io/pypa/manylinux2014_x86_64@FROM quay.io/pypa/manylinux2014_ppc64le@g" Dockerfile_ppc64le |
| 93 | + image_tag=$(cat Dockerfile_ppc64le | grep "Version:" | sed 's/# Version: //') |
| 94 | + echo "image_tag=${image_tag}" >> $GITHUB_ENV |
| 95 | +
|
| 96 | + - name: Login to GitHub Container Registry |
| 97 | + uses: docker/login-action@v3 |
| 98 | + with: |
| 99 | + registry: ghcr.io |
| 100 | + username: ${{ github.repository_owner }} |
| 101 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + |
| 103 | + - name: Build and push image |
| 104 | + uses: docker/build-push-action@v6 |
| 105 | + with: |
| 106 | + context: . |
| 107 | + file: docker/manylinux2014/Dockerfile_ppc64le |
| 108 | + platforms: linux/ppc64le |
| 109 | + push: true |
| 110 | + tags: | |
| 111 | + ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux2014-ppc64le:${{ env.image_tag }} |
| 112 | +
|
| 113 | + build_s390x_manylinux: |
| 114 | + name: Build image for s390x |
| 115 | + runs-on: ubuntu-latest |
| 116 | + needs: check_version |
| 117 | + env: |
| 118 | + version: ${{ needs.check_version.outputs.version }} |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + - uses: docker/setup-qemu-action@v3 |
| 122 | + - uses: docker/setup-buildx-action@v3 |
| 123 | + |
| 124 | + - name: Generate files |
| 125 | + run: | |
| 126 | + mkdir -p docker/manylinux2014 |
| 127 | + wget -qO docker/manylinux2014/Dockerfile_s390x https://github.com/opencv/opencv-python/raw/refs/tags/${version}/docker/manylinux2014/Dockerfile_x86_64 |
| 128 | + cd docker/manylinux2014 |
| 129 | + sed -i "s@FROM quay.io/pypa/manylinux2014_x86_64@FROM quay.io/pypa/manylinux2014_s390x@g" Dockerfile_s390x |
| 130 | + image_tag=$(cat Dockerfile_s390x | grep "Version:" | sed 's/# Version: //') |
| 131 | + echo "image_tag=${image_tag}" >> $GITHUB_ENV |
| 132 | +
|
| 133 | + - name: Login to GitHub Container Registry |
| 134 | + uses: docker/login-action@v3 |
| 135 | + with: |
| 136 | + registry: ghcr.io |
| 137 | + username: ${{ github.repository_owner }} |
| 138 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + |
| 140 | + - name: Build and push image |
| 141 | + uses: docker/build-push-action@v6 |
| 142 | + with: |
| 143 | + context: . |
| 144 | + file: docker/manylinux2014/Dockerfile_s390x |
| 145 | + platforms: linux/s390x |
| 146 | + push: true |
| 147 | + tags: | |
| 148 | + ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux2014-s390x:${{ env.image_tag }} |
0 commit comments