Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # switchbot-mqtt - MQTT client controlling SwitchBot button & curtain automators,
  2. # compatible with home-assistant.io's MQTT Switch & Cover platform
  3. #
  4. # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. DOCKER_IMAGE_NAME := docker.io/fphammerle/switchbot-mqtt
  19. DOCKER_TAG_VERSION := $(shell git describe --match=v* --dirty | sed -e 's/^v//')
  20. ARCH := $(shell arch)
  21. DOCKER_TAG_ARCH_SUFFIX_aarch64 := arm64
  22. DOCKER_TAG_ARCH_SUFFIX_armv6l := armv6
  23. DOCKER_TAG_ARCH_SUFFIX_armv7l := armv7
  24. DOCKER_TAG_ARCH_SUFFIX_x86_64 := amd64
  25. DOCKER_TAG_ARCH_SUFFIX = ${DOCKER_TAG_ARCH_SUFFIX_${ARCH}}
  26. DOCKER_TAG = ${DOCKER_TAG_VERSION}-${DOCKER_TAG_ARCH_SUFFIX}
  27. .PHONY: docker-build docker-push
  28. docker-build:
  29. sudo docker build -t "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  30. docker-push: docker-build
  31. sudo docker push "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}"
  32. @echo git tag --sign --message '$(shell sudo docker image inspect --format '{{join .RepoDigests "\n"}}' "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}")' docker/${DOCKER_TAG} $(shell git rev-parse HEAD)