-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (110 loc) · 4.94 KB
/
Makefile
File metadata and controls
134 lines (110 loc) · 4.94 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
SHELL := /bin/bash
.PHONY: clean docker test run-docker run build-docker-demo
UID=$(shell id -u)
GID=$(shell id -g)
ifeq ($(TARGET_ARCH),)
ARCH=$(shell uname -m)
PLATFORM_STR =
else
ARCH = $(TARGET_ARCH)
PLATFORM_STR = --platform linux/$(TARGET_ARCH)
endif
default:
@echo "Make target 'debian-docker' explicitly."
clean-debian:
rm -rf dist_deb
# Helper function to test if a Docker base image is available
define test_base_image
@docker build --platform linux/$(1) -q - <<< "FROM rust:1-slim-$(2)" >/dev/null 2>&1
endef
debian-docker:
@echo "Building Debian packages for multiple distributions..."
rm -rf dist_deb && mkdir -p dist_deb
for debver in bookworm trixie; do \
echo ""; \
echo "=== Checking availability for Debian $$debver ==="; \
if docker build --platform linux/amd64 -q - <<< "FROM rust:1-slim-$$debver" >/dev/null 2>&1; then \
echo "=== Building packages for Debian $$debver ==="; \
rm -rf server/dist_deb client/dist_deb organizer/basic_folders/dist_deb; \
for plat in arm64 amd64; do \
echo "--- Building server for $$debver/$$plat ---"; \
(cd server && DEBIAN_VER=$$debver TARGET_ARCH=$$plat make debian-docker); \
echo "--- Building organizer for $$debver/$$plat ---"; \
(cd organizer && DEBIAN_VER=$$debver TARGET_ARCH=$$plat make debian-docker); \
done; \
echo "--- Building client for $$debver ---"; \
(cd client && DEBIAN_VER=$$debver make debian-docker); \
echo "--- Collecting $$debver packages ---"; \
cp client/dist_deb/*.deb dist_deb/ 2>/dev/null || true; \
cp server/dist_deb/*.deb dist_deb/ 2>/dev/null || true; \
cp organizer/basic_folders/dist_deb/*.deb dist_deb/ 2>/dev/null || true; \
else \
echo "=== Skipping $$debver (base image not available) ==="; \
fi; \
done
rm dist_deb/*dbgsym* 2>/dev/null || true
@echo ""
@echo "=== Built packages ==="
ls -l dist_deb/
clean: clean-debian
(cd client; make clean)
(cd server; make clean)
(cd organizer; make clean)
(cd protobuf; make clean)
docker:
(cd client; make docker)
(cd server; make docker)
(cd organizer; make docker)
test:
(cd client; make test-docker)
(cd server; make test-docker)
run-docker: debian-docker
DOCKER_BUILDKIT=1 docker build -t clapshot-comb --build-arg UID=${UID} --build-arg GID=${GID} --pull -f Dockerfile.demo .
# Add a simple test video to incoming already
mkdir -p test/VOLUME/data/incoming
cp server/src/tests/assets/60fps-example.mp4 test/VOLUME/data/incoming/
@echo "Removing any existing Unix socket files for macOS Docker compatibility..."
rm -f test/VOLUME/data/grpc-srv-to-org.sock test/VOLUME/data/grpc-org-to-srv.sock
docker run --rm -it -p 0.0.0.0:8080:80 \
--mount type=bind,source="$$(pwd)"/test/VOLUME,target=/mnt/clapshot-data \
--mount type=bind,source="$$(pwd)"/organizer/basic_folders/example_metaplugins,target=/opt/clapshot-org-bf-metaplugins,readonly \
clapshot-comb
build-docker-demo: debian-docker
@which jq || (echo "ERROR: Please install jq first." && exit 1)
$(eval PVER=$(shell jq -r '.version' client/package.json))
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t clapshot:${PVER}-demo \
-t elonen/clapshot:${PVER}-demo \
-t elonen/clapshot:latest-demo \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t clapshot:${PVER}-demo-htadmin \
-t elonen/clapshot:${PVER}-demo-htadmin \
-t elonen/clapshot:latest-demo-htadmin \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo . --build-arg auth_variation=htadmin
build-docker-demo-and-push-hub: debian-docker
@which jq || (echo "ERROR: Please install jq first." && exit 1)
$(eval PVER=$(shell jq -r '.version' client/package.json))
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t elonen/clapshot:${PVER}-demo \
-t elonen/clapshot:latest-demo \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo \
--push .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t elonen/clapshot:${PVER}-demo-htadmin \
-t elonen/clapshot:latest-demo-htadmin \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo --build-arg auth_variation=htadmin \
--push .
build-docker-dev: debian-docker
@which jq || (echo "ERROR: Please install jq first." && exit 1)
$(eval GIT_COMMIT=$(shell git rev-parse --short HEAD))
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t elonen/clapshot:git-${GIT_COMMIT}-demo \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo . --build-arg auth_variation=htadmin
build-docker-dev-and-push-hub: debian-docker
@which jq || (echo "ERROR: Please install jq first." && exit 1)
$(eval GIT_COMMIT=$(shell git rev-parse --short HEAD))
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --pull \
-t elonen/clapshot:git-${GIT_COMMIT}-demo \
--build-arg UID=1002 --build-arg GID=1002 -f Dockerfile.demo --build-arg auth_variation=htadmin \
--push .