1010
1111 build-docker-images :
1212
13+ strategy :
14+ matrix :
15+ image-variant : [prd,dev]
16+
1317 runs-on : ubuntu-20.04
1418
1519 steps :
@@ -29,14 +33,14 @@ jobs:
2933 echo "docker-image-name=${DOCKER_IMAGE_NAME}" >> $GITHUB_OUTPUT
3034 echo "build-date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
3135
32- - name : Fill Docker Image metadata
36+ - name : Fill "${{ steps.prep.outputs.docker-image-name }}" Docker Image metadata
3337 id : meta
3438 uses : docker/metadata-action@v4
3539 with :
3640 github-token : ${{ secrets.GITHUB_TOKEN }}
3741 images : " ${{ steps.prep.outputs.docker-image-name }}"
3842 tags : |
39- type=raw,value=rc
43+ type=raw,value=rc-${{ matrix.image-variant }}
4044
4145 - name : Set up Docker Buildx
4246 id : buildx
@@ -50,36 +54,30 @@ jobs:
5054 restore-keys : |
5155 ${{ runner.os }}-buildx-
5256
53- - name : Build Docker Image
57+ - name : Build "${{ steps.prep.outputs.docker-image-name }}" Docker Image
5458 id : build
5559 uses : docker/build-push-action@v3
5660 with :
5761 builder : ${{ steps.buildx.outputs.name }}
5862 context : .
5963 file : Dockerfile
64+ target : ${{ matrix.image-variant }}
6065 build-args : |
61- VERSION_ARG=${{ env.ELASTICMS_ADMIN_VERSION }}
66+ VERSION_ARG=${{ env.ELASTICMS_CLI_VERSION }}
6267 RELEASE_ARG=${{ env.CI_RUN_ID }}
6368 VCS_REF_ARG=${{ env.CI_SHA }}
6469 BUILD_DATE_ARG=${{ steps.prep.outputs.build-date }}
6570 push : false
6671 load : true
6772 tags : ${{ steps.meta.outputs.tags }}
6873 labels : ${{ steps.meta.outputs.labels }}
69- outputs : type=docker,dest=/tmp/myimage .tar
74+ outputs : type=docker,dest=/tmp/image .tar
7075
71- - name : Squash Docker Image
72- id : squash
76+ - name : Load Docker Image
7377 run : |
74- pip install docker-squash
75- cat /tmp/myimage.tar | docker load
76- docker-squash --verbose --message "Build and Squashed in GitHub Action" \
77- --tag ${{ steps.prep.outputs.docker-image-name }}:rc \
78- --output-path /tmp/myimage.tar \
79- ${{ steps.prep.outputs.docker-image-name }}:rc
80- cat /tmp/myimage.tar | docker load
78+ docker load --input /tmp/image.tar
8179
8280 - name : Check Docker Image
8381 run : |
84- docker image inspect ${{ steps.prep.outputs.docker-image-name }}:rc
85- docker history ${{ steps.prep.outputs.docker-image-name }}:rc
82+ docker image inspect ${{ steps.prep.outputs.docker-image-name }}:rc-${{ matrix.image-variant }}
83+ docker history ${{ steps.prep.outputs.docker-image-name }}:rc-${{ matrix.image-variant }}
0 commit comments