Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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 --abbrev=0 | sed -e 's/^v//')
  20. DOCKER_TAG = ${DOCKER_TAG_VERSION}-armv6
  21. .PHONY: docker-build podman-build docker-push
  22. docker-build:
  23. sudo docker build --tag="${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  24. podman-build:
  25. # --format=oci (default) not fully supported by hub.docker.com
  26. # https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
  27. podman build --format=docker --tag="${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  28. docker-push: docker-build
  29. sudo docker push "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}"
  30. @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)