@@ -9,14 +9,21 @@ inputs:
99 required : false
1010 description : " Tag latest version"
1111 default : " false"
12+ target :
13+ required : false
14+ description : " Docker stage to target"
15+ default : " final"
1216
1317outputs :
14- version :
15- description : " The version for the image"
16- value : ${{ steps.meta.outputs.version }}
1718 image :
1819 description : " The Docker image"
1920 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 }}
2027 tag :
2128 description : " Combines image and version to a valid image tag"
2229 value : ${{ steps.tag.outputs.tag }}
@@ -76,25 +83,17 @@ runs:
7683
7784 - name : Build Image
7885 id : build
79- uses : docker/bake-action@v4
80- env :
81- DOCKER_TAG : ${{ steps.tag.outputs.tag }}
86+ uses : docker/build-push-action@v6
8287 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.node_env }}
9897
9998 - name : Upload artifact
10099 uses : actions/upload-artifact@v4
@@ -106,3 +105,9 @@ runs:
106105 retention-days : 1
107106 compression-level : 9
108107 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