Is there a way to specify multiple tags when using docker/build-push-action@v2
?
I tried specifying multiple tags separated by a space or comma and they both failed.
Error
buildx failed with: error: invalid tag "***/myapp:1.4.0 ***/myapp:latest": invalid reference format
.github/workflows/publish.yml
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/myapp:${{ steps.vars.outputs.tag }} ${{ secrets.DOCKER_HUB_USERNAME }}/myapp:latest
2
Answers
Check here https://github.com/docker/build-push-action#customizing, add a comma between the tags, like this:
You can also use a "newline-delimited string". I think this is better when you have longer strings: