@@ -9,14 +9,21 @@ inputs:
9
9
required : false
10
10
description : " Tag latest version"
11
11
default : " false"
12
+ target :
13
+ required : false
14
+ description : " Docker stage to target"
15
+ default : " final"
12
16
13
17
outputs :
14
- version :
15
- description : " The version for the image"
16
- value : ${{ steps.meta.outputs.version }}
17
18
image :
18
19
description : " The Docker image"
19
20
value : ${{ steps.image.outputs.image }}
21
+ version :
22
+ description : " The version for the image"
23
+ value : ${{ steps.meta.outputs.version }}
24
+ digest :
25
+ description : " The build digest for the image"
26
+ value : ${{ steps.build.outputs.digest }}
20
27
tag :
21
28
description : " Combines image and version to a valid image tag"
22
29
value : ${{ steps.tag.outputs.tag }}
@@ -76,25 +83,17 @@ runs:
76
83
77
84
- name : Build Image
78
85
id : build
79
- uses : docker/bake-action@v4
80
- env :
81
- DOCKER_TAG : ${{ steps.tag.outputs.tag }}
86
+ uses : docker/build-push-action@v6
82
87
with :
83
- targets : app
84
- load : true
85
-
86
- - name : Get image digest
87
- id : digest
88
- shell : bash
89
- run : |
90
- echo '${{ steps.build.outputs.metadata }}' > metadata.json
91
- echo "digest=$(cat metadata.json | jq -r '.app."containerimage.digest"')" >> $GITHUB_OUTPUT
92
- cat $GITHUB_OUTPUT
93
-
94
- - name : Save Docker Image to Tar
95
- shell : bash
96
- run : |
97
- docker save -o /tmp/image.tar ${{ steps.tag.outputs.tag }}
88
+ platforms : linux/amd64
89
+ # Inject metadata produced earlier
90
+ tags : ${{ steps.meta.outputs.tags }}
91
+ labels : ${{ steps.meta.outputs.labels }}
92
+ annotations : ${{ steps.meta.outputs.annotations }}
93
+ # Output image to a local tar file to be uploaded
94
+ outputs : type=docker,dest=${{ steps.tar.outputs.path }}
95
+ # Target a specified stage
96
+ target : ${{ inputs.target }}
98
97
99
98
- name : Upload artifact
100
99
uses : actions/upload-artifact@v4
@@ -106,3 +105,9 @@ runs:
106
105
retention-days : 1
107
106
compression-level : 9
108
107
overwrite : true
108
+
109
+ - name : Load Docker image
110
+ shell : bash
111
+ run : |
112
+ # Load the Docker image
113
+ docker load -i /tmp/image.tar
0 commit comments