Makefile 1.3 KB

123456789101112131415161718192021222324252627282930
  1. # sync with https://github.com/fphammerle/docker-onion-service/blob/master/Makefile
  2. IMAGE_NAME = docker.io/fphammerle/brave-browser
  3. PROJECT_VERSION = $(shell git describe --match=v* --abbrev=0 --dirty | sed -e 's/^v//')
  4. BRAVE_BROWSER_PACKAGE_VERSION = $(shell grep -Po 'BRAVE_BROWSER_PACKAGE_VERSION=\K.+' Dockerfile | tr -d -)
  5. ARCH = $(shell arch)
  6. # currently brave only provides builds for amd64
  7. IMAGE_TAG_ARCH_x86_64 = amd64
  8. IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
  9. IMAGE_TAG = ${PROJECT_VERSION}-browser${BRAVE_BROWSER_PACKAGE_VERSION}-${IMAGE_TAG_ARCH}
  10. BUILD_PARAMS = --tag="${IMAGE_NAME}:${IMAGE_TAG}" \
  11. --build-arg=REVISION="$(shell git rev-parse HEAD)"
  12. .PHONY: worktree-clean docker-build podman-build docker-push
  13. worktree-clean:
  14. git diff --exit-code
  15. git diff --staged --exit-code
  16. docker-build: worktree-clean
  17. sudo docker build ${BUILD_PARAMS} .
  18. podman-build: worktree-clean
  19. # --format=oci (default) not fully supported by hub.docker.com
  20. # https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
  21. podman build --format=docker ${BUILD_PARAMS} .
  22. docker-push: docker-build
  23. sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
  24. @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)