@@ -32,67 +32,50 @@ jobs:
3232 - name: Set up Docker Buildx
3333 uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
3434
35- {% if docker_io_enabled %}
36- - name: Log in to Docker Hub
37- uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
38- with:
39- username: {% raw %} ${{ secrets.DOCKER_IO_USERNAME }}{% endraw %}
40- password: {% raw %} ${{ secrets.DOCKER_IO_PASSWORD }}{% endraw %}
41- {% endif %}
42-
43- - name: Log in to GitHub Container Registry
44- uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
45- with:
46- registry: ghcr.io
47- username: {% raw %} ${{ github.repository_owner }}{% endraw %}
48- password: {% raw %} ${{ secrets.GITHUB_TOKEN }}{% endraw %}
49-
50- - name: Extract metadata for Docker
51- id: meta
52- uses: docker/metadata-action@38b8a86137171c128513e9be0b97bc476fbffcb5 # v5.6.0
53- with:
54- images: |
55- ghcr.io/{{ github_repository_owner }}/{{ github_repository_name }}
56- {% if docker_io_enabled %}
57- {% raw %} ${{ env.DOCKER_IO_IMAGE_NAME_ALL }}{% endraw %}
58- {% endif %}
59- flavor: |
60- latest=auto
61- prefix=
62- suffix=
63- tags: |
64- type=semver,pattern={{raw}}v{{version}}{{endraw}}
65- type=semver,pattern={{raw}}v{{major}}.{{minor}}{{endraw}}
66- type=semver,pattern={{raw}}v{{major}}{{endraw}}
67-
68- - name: Build and push Docker image (all)
69- uses: docker/build-push-action@e6ef1f314e8a75f35e85dbd71ebe08d4b3005fc8 # v6.2.0
35+ {% raw %}
36+ - name: "(all target): Build and push Docker image"
37+ id: build-and-push-all
38+ uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
7039 with:
7140 context: .
72- push: true
73- tags: {% raw %} ${{ steps.meta.outputs.tags }}{% endraw %}
74- labels: {% raw %} ${{ steps.meta.outputs.labels }}{% endraw %}
75- platforms: linux/amd64,linux/arm64
41+ file: ./Dockerfile
7642 target: all
77- provenance: true
78- cache-from: type=gha
79- cache-to: type=gha,mode=max
43+ platforms: linux/amd64,linux/arm64
44+ push: true
45+ tags: ${{ steps.meta-all.outputs.tags }}
46+ labels: ${{ steps.meta-all.outputs.labels }}
47+ {% endraw %}
8048
81- - name: Build and push Docker image (slim)
82- uses: docker/build-push-action@e6ef1f314e8a75f35e85dbd71ebe08d4b3005fc8 # v6.2.0
49+ {% raw %}
50+ - name: "(slim target): Build and push Docker image"
51+ id: build-and-push-slim
52+ uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
8353 with:
8454 context: .
55+ file: ./Dockerfile
56+ target: slim
57+ platforms: linux/amd64,linux/arm64
8558 push: true
86- tags: |
87- ghcr.io/{{ github_repository_owner }}/{{ github_repository_name }}-slim:latest
88- ghcr.io/{{ github_repository_owner }}/{{ github_repository_name }}-slim:{% raw %} ${{ github.ref_name }}{% endraw %}
59+ tags: ${{ steps.meta-slim.outputs.tags }}
60+ labels: ${{ steps.meta-slim.outputs.labels }}
61+ {% endraw %}
62+
8963{% if docker_io_enabled %}
90- {% raw %} ${{ env.DOCKER_IO_IMAGE_NAME_SLIM }}{% endraw %} :latest
91- {% raw %} ${{ env.DOCKER_IO_IMAGE_NAME_SLIM }}{% endraw %} :{% raw %} ${{ github.ref_name }}{% endraw %}
92- {% endif %}
93- labels: {% raw %} ${{ steps.meta.outputs.labels }}{% endraw %}
94- platforms: linux/amd64,linux/arm64
95- target: slim
96- provenance: true
97- cache-from: type=gha
98- cache-to: type=gha,mode=max
64+ {% if attestations_enabled %}
65+ {% raw %}
66+ - name: "(all target): Generate artifact attestation"
67+ uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
68+ with:
69+ subject-name: ${{ env.DOCKER_IO_REGISTRY }}/${{ env.DOCKER_IO_IMAGE_NAME_ALL }}
70+ subject-digest: ${{ steps.build-and-push-all.outputs.digest }}
71+ push-to-registry: true{% endraw %}{% endif %}{% endif %}
72+
73+ {% if docker_io_enabled %}
74+ {% if attestations_enabled %}
75+ {% raw %}
76+ - name: "(slim target): Generate artifact attestation"
77+ uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
78+ with:
79+ subject-name: ${{ env.DOCKER_IO_REGISTRY }}/${{ env.DOCKER_IO_IMAGE_NAME_SLIM }}
80+ subject-digest: ${{ steps.build-and-push-slim.outputs.digest }}
81+ push-to-registry: true{% endraw %}{% endif %}{% endif %}
0 commit comments