diff --git a/.github/actions/build/docker/action.yml b/.github/actions/build/docker/action.yml index 4bd55e2e..70e95812 100644 --- a/.github/actions/build/docker/action.yml +++ b/.github/actions/build/docker/action.yml @@ -54,6 +54,16 @@ runs: osctrl-${{ inputs.osctrl_component }}-${{ inputs.commit_sha }}-${{ inputs.go_os }}-${{ inputs.go_arch }}.bin \ osctrl-${{ inputs.osctrl_component }}-${{ inputs.go_os }}-${{ inputs.go_arch }}.bin + ########################### Add meta data ########################### + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ inputs.docker_hub_org }}/osctrl-${{ inputs.osctrl_component }} + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + type=semver,pattern={{version}} + ########################### Log into Dockerhub ########################### - name: Login to Docker Hub uses: docker/login-action@v3.0.0 @@ -77,7 +87,7 @@ runs: context: . file: ./deploy/cicd/docker/Dockerfile-osctrl-${{ inputs.osctrl_component }} push: true - tags: ${{ inputs.docker_hub_org }}/osctrl-${{ inputs.osctrl_component }}:${{ inputs.docker_tag }} + labels: ${{ steps.meta.outputs.labels }} platforms: "${{ inputs.go_os }}/${{ inputs.go_arch }}" outputs: type=image,name=osctrl-${{ inputs.osctrl_component }},push-by-digest=true,name-canonical=true,push=true build-args: | diff --git a/.github/workflows/build_and_test_main_merge.yml b/.github/workflows/build_and_test_main_merge.yml index dfdd9625..05d953e6 100644 --- a/.github/workflows/build_and_test_main_merge.yml +++ b/.github/workflows/build_and_test_main_merge.yml @@ -169,6 +169,15 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ inputs.docker_hub_org }}/osctrl-${{ inputs.osctrl_component }} + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + type=semver,pattern={{version}} + ########################### Log into Dockerhub ########################### - name: Login to Docker Hub uses: docker/login-action@v3.0.0