Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # location-guessing-game-telegram-bot - Telegram Bot Sending Random Wikimedia Commons Photos
  2. #
  3. # Copyright (C) 2021 Fabian Peter Hammerle <fabian@hammerle.me>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. # sync with https://github.com/fphammerle/switchbot-mqtt/blob/master/Makefile
  18. IMAGE_NAME = docker.io/fphammerle/location-guessing-game-telegram-bot
  19. PROJECT_VERSION = $(shell git describe --match=v* --always --dirty | sed -e 's/^v//')
  20. ARCH = $(shell arch)
  21. # architecture[arm_variant]
  22. # https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
  23. IMAGE_TAG_ARCH_aarch64 = arm64
  24. IMAGE_TAG_ARCH_armv6l = armv6
  25. IMAGE_TAG_ARCH_armv7l = armv7
  26. IMAGE_TAG_ARCH_x86_64 = amd64
  27. IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
  28. IMAGE_TAG = ${PROJECT_VERSION}-${IMAGE_TAG_ARCH}
  29. .PHONY: docker-build podman-build docker-push
  30. docker-build:
  31. sudo docker build --tag="${IMAGE_NAME}:${IMAGE_TAG}" .
  32. podman-build:
  33. # --format=oci (default) not fully supported by hub.docker.com
  34. # https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
  35. podman build --format=docker --tag="${IMAGE_NAME}:${IMAGE_TAG}" .
  36. docker-push: docker-build
  37. sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
  38. @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)