|
43 | 43 | - name: Checkout |
44 | 44 | uses: actions/checkout@v4 |
45 | 45 |
|
| 46 | + - name: Set up Docker Buildx |
| 47 | + uses: docker/setup-buildx-action@v3 |
| 48 | + |
| 49 | + - name: Cache Docker layers |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: | |
| 53 | + C:\Users\runneradmin\.docker\buildx\cache |
| 54 | + key: docker-win-${{ matrix.windows_version }}-${{ matrix.container_type }}-${{ github.sha }} |
| 55 | + restore-keys: | |
| 56 | + docker-win-${{ matrix.windows_version }}-${{ matrix.container_type }}- |
| 57 | +
|
46 | 58 | - name: Login to GitHub Container Registry |
47 | 59 | if: env.IMAGE_PUSH == 'true' |
48 | 60 | uses: docker/login-action@v3 |
@@ -98,25 +110,14 @@ jobs: |
98 | 110 | Write-Host "Tags: $tagsString" |
99 | 111 |
|
100 | 112 | - name: Build and push Windows container |
101 | | - shell: pwsh |
102 | | - run: | |
103 | | - $tags = "${{ steps.meta.outputs.tags }}".Split(",") |
104 | | - $tagArgs = @() |
105 | | - foreach ($tag in $tags) { |
106 | | - $tagArgs += "-t" |
107 | | - $tagArgs += $tag.Trim() |
108 | | - } |
109 | | -
|
110 | | - docker build ` |
111 | | - --build-arg WINDOWS_VERSION=${{ steps.tag.outputs.windows_version }} ` |
112 | | - --build-arg WINDOWS_TYPE=${{ matrix.container_type }} ` |
113 | | - -f Dockerfile.windows ` |
114 | | - $tagArgs ` |
115 | | - . |
116 | | -
|
117 | | - if ("${{ env.IMAGE_PUSH }}" -eq "true") { |
118 | | - foreach ($tag in $tags) { |
119 | | - Write-Host "Pushing $($tag.Trim())" |
120 | | - docker push $tag.Trim() |
121 | | - } |
122 | | - } |
| 113 | + uses: docker/build-push-action@v6 |
| 114 | + with: |
| 115 | + context: . |
| 116 | + file: Dockerfile.windows |
| 117 | + build-args: | |
| 118 | + WINDOWS_VERSION=${{ steps.tag.outputs.windows_version }} |
| 119 | + WINDOWS_TYPE=${{ matrix.container_type }} |
| 120 | + push: ${{ env.IMAGE_PUSH }} |
| 121 | + tags: ${{ steps.meta.outputs.tags }} |
| 122 | + cache-from: type=gha |
| 123 | + cache-to: type=gha,mode=max |
0 commit comments