Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 podman-build docker-push
  28. docker-build:
  29. sudo docker build --tag="${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  30. podman-build:
  31. # --format=oci (default) not fully supported by hub.docker.com
  32. # https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
  33. podman build --format=docker --tag="${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  34. docker-push: docker-build
  35. sudo docker push "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}"
  36. @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)