Combine multi-tag builds into one buildx command using multiple --tag options
- Dominant language
- Shell
- Stars
- 6
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Currently, we build (and push) the image twice when tagging a release with both the full tag (ie `1.2.3`) and the major/minor moving tag (ie `1.2`).
`buildx` now (or always?) [supports multiple `--tag` options](https://github.com/docker/buildx/issues/396) so we can tag and push from a single build.
We can change [this](https://github.com/jgriff/http-resource/blob/f31bc6ee7858a3c1bdbdc3ab5229541133053f98/Makefile#L68):
```
@docker buildx build --builder http-resource-builder --platform linux/amd64,linux/arm64/v8 --push --tag ${IMAGE}:$(shell echo ${TAG} | rev | cut -d '.' -f2- | rev ) .
@docker buildx build --builder http-resource-builder --platform linux/amd64,linux/arm64/v8 --push --tag ${IMAGE}:${TAG} .
```
to this:
```
@docker buildx build --builder http-resource-builder --platform linux/amd64,linux/arm64/v8 --push --tag ${IMAGE}:${TAG} --tag ${IMAGE}:$(shell echo ${TAG} | rev | cut -d '.' -f2- | rev ) .
```
Contributor guide
Assessment
This issue has not been assessed yet.