Makefile 931 B

12345678910111213141516171819202122
  1. # sync with https://github.com/fphammerle/switchbot-mqtt/blob/master/Makefile
  2. IMAGE_NAME = docker.io/fphammerle/systemctl-mqtt
  3. BUILD_VERSION = $(shell git describe --match=v* --dirty | sed -e 's/^v//')
  4. ARCH = $(shell arch)
  5. # architecture[arm_variant]
  6. # https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
  7. IMAGE_TAG_ARCH_aarch64 = arm64
  8. IMAGE_TAG_ARCH_armv6l = armv6
  9. IMAGE_TAG_ARCH_armv7l = armv7
  10. IMAGE_TAG_ARCH_x86_64 = amd64
  11. IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
  12. IMAGE_TAG = ${BUILD_VERSION}-${IMAGE_TAG_ARCH}
  13. .PHONY: docker-build docker-push
  14. docker-build:
  15. sudo docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" .
  16. docker-push: docker-build
  17. sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
  18. @echo git tag --sign --message '$(shell sudo docker image inspect --format '{{join .RepoDigests "\n"}}' "${IMAGE_NAME}:${IMAGE_TAG}")' docker/${IMAGE_TAG} $(shell git rev-parse HEAD)