|
18 | 18 |
|
19 | 19 | jobs: |
20 | 20 |
|
| 21 | + # Build job for py314t image (base Python image) |
| 22 | + build-py314t: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + packages: write |
| 27 | + id-token: write |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + platform: |
| 32 | + - linux/amd64 |
| 33 | + - linux/arm64 |
| 34 | + steps: |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Inject slug/short variables |
| 39 | + uses: rlespinasse/github-slug-action@v4.4.1 |
| 40 | + |
| 41 | + - name: Prepare |
| 42 | + run: | |
| 43 | + platform=${{ matrix.platform }} |
| 44 | + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
| 45 | +
|
| 46 | + # Install the cosign tool except on PR |
| 47 | + - name: Install cosign |
| 48 | + if: github.event_name != 'pull_request' |
| 49 | + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 |
| 50 | + with: |
| 51 | + cosign-release: 'v2.1.1' |
| 52 | + |
| 53 | + # Set up QEMU for cross-platform builds |
| 54 | + - name: Set up QEMU |
| 55 | + uses: docker/setup-qemu-action@v3 |
| 56 | + |
| 57 | + # Set up BuildKit Docker container builder |
| 58 | + - name: Set up Docker Buildx |
| 59 | + uses: docker/setup-buildx-action@v3 |
| 60 | + |
| 61 | + # Login against a Docker registry except on PR |
| 62 | + - name: Log into registry ${{ env.REGISTRY }} |
| 63 | + if: github.event_name != 'pull_request' |
| 64 | + uses: docker/login-action@v3 |
| 65 | + with: |
| 66 | + registry: ${{ env.REGISTRY }} |
| 67 | + username: ${{ github.actor }} |
| 68 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Build and push by digest |
| 71 | + id: build-py314t |
| 72 | + uses: docker/build-push-action@v6 |
| 73 | + with: |
| 74 | + provenance: false |
| 75 | + sbom: false |
| 76 | + file: docker/Dockerfile.py314t_rust |
| 77 | + target: py314t |
| 78 | + platforms: ${{ matrix.platform }} |
| 79 | + tags: ghcr.io/insight-platform/py314t |
| 80 | + outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} |
| 81 | + context: . |
| 82 | + cache-from: type=gha |
| 83 | + cache-to: type=gha,mode=max |
| 84 | + |
| 85 | + - name: Export digest |
| 86 | + run: | |
| 87 | + mkdir -p ${{ runner.temp }}/digests-py314t |
| 88 | + digest="${{ steps.build-py314t.outputs.digest }}" |
| 89 | + touch "${{ runner.temp }}/digests-py314t/${digest#sha256:}" |
| 90 | +
|
| 91 | + - name: Upload digest |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: digests-py314t-${{ env.PLATFORM_PAIR }} |
| 95 | + path: ${{ runner.temp }}/digests-py314t/* |
| 96 | + if-no-files-found: error |
| 97 | + retention-days: 1 |
| 98 | + |
| 99 | + # Merge job for py314t image |
| 100 | + merge-py314t: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: |
| 103 | + - build-py314t |
| 104 | + if: github.event_name != 'pull_request' |
| 105 | + permissions: |
| 106 | + contents: read |
| 107 | + packages: write |
| 108 | + steps: |
| 109 | + - name: Inject slug/short variables |
| 110 | + uses: rlespinasse/github-slug-action@v4.4.1 |
| 111 | + |
| 112 | + - name: Download digests |
| 113 | + uses: actions/download-artifact@v4 |
| 114 | + with: |
| 115 | + path: ${{ runner.temp }}/digests-py314t |
| 116 | + pattern: digests-py314t-* |
| 117 | + merge-multiple: true |
| 118 | + |
| 119 | + - name: Set up Docker Buildx |
| 120 | + uses: docker/setup-buildx-action@v3 |
| 121 | + |
| 122 | + - name: Log into registry ${{ env.REGISTRY }} |
| 123 | + uses: docker/login-action@v3 |
| 124 | + with: |
| 125 | + registry: ${{ env.REGISTRY }} |
| 126 | + username: ${{ github.actor }} |
| 127 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 128 | + |
| 129 | + - name: Create manifest list and push |
| 130 | + working-directory: ${{ runner.temp }}/digests-py314t |
| 131 | + run: | |
| 132 | + docker buildx imagetools create \ |
| 133 | + -t ghcr.io/insight-platform/py314t:${{ env.GITHUB_REF_SLUG }} \ |
| 134 | + $(printf 'ghcr.io/insight-platform/py314t@sha256:%s ' *) |
| 135 | +
|
| 136 | + - name: Inspect image |
| 137 | + run: | |
| 138 | + docker buildx imagetools inspect ghcr.io/insight-platform/py314t:${{ env.GITHUB_REF_SLUG }} |
| 139 | +
|
21 | 140 | # Build job for py314t_rust image |
22 | 141 | build-py314t-rust: |
23 | 142 | runs-on: ubuntu-latest |
@@ -68,12 +187,13 @@ jobs: |
68 | 187 | password: ${{ secrets.GITHUB_TOKEN }} |
69 | 188 |
|
70 | 189 | - name: Build and push by digest |
71 | | - id: build |
| 190 | + id: build-py314t-rust |
72 | 191 | uses: docker/build-push-action@v6 |
73 | 192 | with: |
74 | 193 | provenance: false |
75 | 194 | sbom: false |
76 | 195 | file: docker/Dockerfile.py314t_rust |
| 196 | + target: py314t_rust |
77 | 197 | platforms: ${{ matrix.platform }} |
78 | 198 | tags: ghcr.io/insight-platform/py314t_rust |
79 | 199 | outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} |
|
84 | 204 | - name: Export digest |
85 | 205 | run: | |
86 | 206 | mkdir -p ${{ runner.temp }}/digests-py314trust |
87 | | - digest="${{ steps.build.outputs.digest }}" |
| 207 | + digest="${{ steps.build-py314t-rust.outputs.digest }}" |
88 | 208 | touch "${{ runner.temp }}/digests-py314trust/${digest#sha256:}" |
89 | 209 |
|
90 | 210 | - name: Upload digest |
|
95 | 215 | if-no-files-found: error |
96 | 216 | retention-days: 1 |
97 | 217 |
|
98 | | - |
99 | 218 | # Merge job for py314t_rust image |
100 | 219 | merge-py314t-rust: |
101 | 220 | runs-on: ubuntu-latest |
|
0 commit comments