1
0

Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # sync with https://github.com/fphammerle/docker-onion-service/blob/master/Makefile
  2. IMAGE_NAME = docker.io/fphammerle/gitolite
  3. PROJECT_VERSION = $(shell git describe --match=v* --abbrev=0 --dirty | sed -e 's/^v//')
  4. GITOLITE_PACKAGE_VERSION = $(shell grep -Po 'GITOLITE_PACKAGE_VERSION=\K.+' Dockerfile | tr - _)
  5. GIT_ANNEX_PACKAGE_VERSION = $(shell grep -Po 'GIT_ANNEX_PACKAGE_VERSION=\K.+' Dockerfile | tr - _)
  6. GIT_PACKAGE_VERSION = $(shell grep -Po 'GIT_PACKAGE_VERSION=1:\K.+' Dockerfile | tr + _)
  7. ARCH = $(shell arch)
  8. # architecture[arm_variant]
  9. # https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
  10. IMAGE_TAG_ARCH_aarch64 = arm64
  11. IMAGE_TAG_ARCH_armv6l = armv6
  12. IMAGE_TAG_ARCH_armv7l = armv7
  13. IMAGE_TAG_ARCH_x86_64 = amd64
  14. IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
  15. IMAGE_TAG = ${PROJECT_VERSION}-gitolite${GITOLITE_PACKAGE_VERSION}-git${GIT_PACKAGE_VERSION}-gitannex${GIT_ANNEX_PACKAGE_VERSION}-${IMAGE_TAG_ARCH}
  16. BUILD_PARAMS = --tag="${IMAGE_NAME}:${IMAGE_TAG}" \
  17. --build-arg=REVISION="$(shell git rev-parse HEAD)"
  18. .PHONY: worktree-clean docker-build podman-build docker-push
  19. worktree-clean:
  20. git diff --exit-code
  21. git diff --staged --exit-code
  22. docker-build: worktree-clean
  23. sudo docker build ${BUILD_PARAMS} .
  24. podman-build: worktree-clean
  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 ${BUILD_PARAMS} .
  28. docker-push: docker-build
  29. sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
  30. @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)