.PHONY: build-production
build-production: ## Build the production container image.
	@podman manifest rm registry.tanshu.com/brewman:latest 2>/dev/null || true
	@podman build \
		--platform linux/amd64,linux/arm64 \
		--manifest registry.tanshu.com/brewman:latest \
		git@git.tanshu.com:tanshu/brewman.git$(if $(TAG),#v$(TAG))
	@podman manifest push --all registry.tanshu.com/brewman:latest docker://registry.tanshu.com/brewman:latest
	$(if $(TAG),@podman manifest push --all registry.tanshu.com/brewman:latest docker://registry.tanshu.com/brewman:$(TAG))

.PHONY: build-check
build-check: ## Multi-arch build without push (compile check)
	@podman manifest rm brewman:test 2>/dev/null || true
	@podman build \
		--platform linux/amd64,linux/arm64 \
		--manifest brewman:test \
		--pull \
		git@git.tanshu.com:tanshu/brewman.git

.PHONY: build-check-local
build-check-local: ## Local build without push (compile check)
	@git archive --format=tar HEAD | podman build \
		--platform linux/amd64 \
		--tag brewman:test \
		--pull \
		-

