This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
33 lines (28 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
IMAGE_NAME = docker.io/fphammerle/tor-obfs4-bridge
PROJECT_VERSION = $(shell git describe --match=v* --abbrev=0 --dirty | sed -e 's/^v//')
TOR_PACKAGE_VERSION = $(shell grep -Po 'TOR_PACKAGE_VERSION=\K.+' Dockerfile | tr -d -)
LYREBIRD_PACKAGE_VERSION = $(shell grep -Po 'LYREBIRD_PACKAGE_VERSION=\K.+' Dockerfile | tr -d -)
ARCH = $(shell arch)
# architecture[arm_variant]
# https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
IMAGE_TAG_ARCH_aarch64 = arm64
IMAGE_TAG_ARCH_armv6l = armv6
IMAGE_TAG_ARCH_armv7l = armv7
IMAGE_TAG_ARCH_x86_64 = amd64
IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
IMAGE_TAG = ${PROJECT_VERSION}-tor${TOR_PACKAGE_VERSION}-lyrebird${LYREBIRD_PACKAGE_VERSION}-${IMAGE_TAG_ARCH}
BUILD_PARAMS = --tag="${IMAGE_NAME}:${IMAGE_TAG}" \
--build-arg=REVISION="$(shell git rev-parse HEAD)"
.PHONY: worktree-clean docker-build podman-build docker-push
worktree-clean:
git diff --exit-code
git diff --staged --exit-code
docker-build: worktree-clean
sudo docker build ${BUILD_PARAMS} .
podman-build: worktree-clean
# --format=oci (default) not fully supported by hub.docker.com
# https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
podman build --format=docker ${BUILD_PARAMS} .
docker-push: docker-build
sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
@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)