1
0

Makefile 1.1 KB

1234567891011121314151617181920212223
  1. # sync with https://github.com/fphammerle/docker-onion-service/blob/master/Makefile
  2. DOCKER_IMAGE_NAME := docker.io/fphammerle/dovecot
  3. DOCKER_TAG_VERSION := $(shell git describe --match=v* --abbrev=0 --dirty | sed -e 's/^v//')
  4. DOVECOT_PACKAGE_VERSION := $(shell grep -Po 'DOVECOT_PACKAGE_VERSION=\K.+' Dockerfile | tr -d -)
  5. ARCH := $(shell arch)
  6. DOCKER_TAG_ARCH_SUFFIX_aarch64 := arm64
  7. DOCKER_TAG_ARCH_SUFFIX_armv6l := armv6
  8. DOCKER_TAG_ARCH_SUFFIX_x86_64 := amd64
  9. DOCKER_TAG_ARCH_SUFFIX = ${DOCKER_TAG_ARCH_SUFFIX_${ARCH}}
  10. DOCKER_TAG = ${DOCKER_TAG_VERSION}-dovecot${DOVECOT_PACKAGE_VERSION}-${DOCKER_TAG_ARCH_SUFFIX}
  11. .PHONY: docker-build docker-push
  12. docker-build:
  13. git diff --exit-code
  14. git diff --staged --exit-code
  15. sudo docker build -t "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
  16. docker-push: docker-build
  17. sudo docker push "${DOCKER_IMAGE_NAME}:${DOCKER_TAG}"
  18. sleep 4 # wait for repo digest
  19. @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)