This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
48 lines (34 loc) · 1.98 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
default_target: local
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
REF_NAME := $(shell git symbolic-ref --short HEAD)
VERSION = 0.0.1
GHCR_IMAGE_REPO ?= ghcr.io/nanosonde/sip2rtsp
DOCKERHUB_IMAGE_REPO ?= nanosonde/sip2rtsp
CURRENT_UID := $(shell id -u)
CURRENT_GID := $(shell id -g)
version:
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > sip2rtsp/version.py
local: version
docker buildx build --target=sip2rtsp --tag sip2rtsp:latest --load .
amd64: version
docker buildx build --platform linux/amd64 --target=sip2rtsp --tag $(GHCR_IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
arm64: version
docker buildx build --platform linux/arm64 --target=sip2rtsp --tag $(GHCR_IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
armv7: version
docker buildx build --platform linux/arm/v7 --target=sip2rtsp --tag $(GHCR_IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
build: version
docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64 --target=sip2rtsp --tag $(GHCR_IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
push_ghcr:
docker buildx build --push --platform linux/arm/v7,linux/arm64,linux/amd64 --target=sip2rtsp --tag $(GHCR_IMAGE_REPO):${REF_NAME}-$(COMMIT_HASH) .
push_docker:
docker buildx build --push --platform linux/arm/v7,linux/arm64,linux/amd64 --target=sip2rtsp --tag $(DOCKERHUB_IMAGE_REPO):$(REF_NAME)-$(COMMIT_HASH) .
run: local
docker run --rm --network host --volume=${PWD}/config/config.yml:/config/config.yml --volume=${PWD}/config/baresip:/config/baresip --name sip2rtsp sip2rtsp:latest
run_shell: local
docker run --rm --network host --volume=${PWD}/config/config.yml:/config/config.yml --volume=${PWD}/config/baresip:/config/baresip --name sip2rtsp-shell -it sip2rtsp:latest /bin/bash
run_tests: local
docker run --rm --workdir=/opt/sip2rtsp --entrypoint= sip2rtsp:latest python3 -u -m unittest
docker run --rm --workdir=/opt/sip2rtsp --entrypoint= sip2rtsp:latest python3 -u -m mypy --config-file sip2rtsp/mypy.ini sip2rtsp
prune_build_cache:
docker builder prune
.PHONY: run_tests