Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 2.44 KB
/
Copy pathMakefile
File metadata and controls
68 lines (56 loc) · 2.44 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
.PHONY: packaging packaging-build packaging-compose-config packaging-smoke
.PHONY: packaging-measure packaging-validate packaging-up packaging-down
.PHONY: dev test-vaapi test-browser
IMAGE ?= filetwist:prototype
DEV_PORT ?= 18769
VERSION ?= $(shell git rev-parse --short=12 HEAD)
REVISION ?= $(shell git rev-parse HEAD)
RENDER_DEVICE ?= /dev/dri/renderD128
COMPOSE = FILETWIST_IMAGE=$(IMAGE) FILETWIST_VERSION=$(VERSION) FILETWIST_REVISION=$(REVISION) docker compose --file deploy/compose.yaml
packaging: packaging-up
packaging-build:
docker build \
--platform linux/amd64 \
--file deploy/Dockerfile \
--build-arg VERSION=$(VERSION) \
--build-arg REVISION=$(REVISION) \
--tag $(IMAGE) .
dev: IMAGE = filetwist:dev
dev: packaging-build
@echo "Open http://127.0.0.1:$(DEV_PORT)/"
@echo "Press Ctrl+C to stop. Uploaded files and results are temporary."
docker run --rm --init \
--platform linux/amd64 \
--publish 127.0.0.1:$(DEV_PORT):8080 \
--env ACCELERATION=cpu \
$(IMAGE)
packaging-compose-config:
$(COMPOSE) config --quiet
$(COMPOSE) --file deploy/compose.cpu.yaml config --quiet
FILETWIST_RENDER_GID=0 $(COMPOSE) --file deploy/compose.vaapi.yaml config --quiet
FILETWIST_PORT=18080 FILETWIST_CONTAINER_PORT=9443 $(COMPOSE) config --quiet
FILETWIST_CONTAINER_PORT=9443 $(COMPOSE) config | grep -q 'LISTEN_ADDRESS: .*9443'
FILETWIST_CONTAINER_PORT=9443 $(COMPOSE) config | grep -q 'target: 9443'
FILETWIST_PORT= $(COMPOSE) config | grep -q 'host_ip: 127.0.0.1'
FILETWIST_PORT=0.0.0.0:18080 $(COMPOSE) config | grep -q 'host_ip: 0.0.0.0'
packaging-smoke: packaging-build
scripts/validate-container.sh $(IMAGE)
packaging-measure: packaging-build
scripts/measure-container.sh $(IMAGE)
packaging-validate: packaging-compose-config packaging-smoke packaging-measure
packaging-up: packaging-validate
@if test -c "$(RENDER_DEVICE)"; then \
render_gid=$$(stat -Lc '%g' "$(RENDER_DEVICE)"); \
echo "Starting with VA-API device $(RENDER_DEVICE), group $$render_gid"; \
VAAPI_DEVICE="$(RENDER_DEVICE)" FILETWIST_RENDER_GID=$$render_gid \
$(COMPOSE) --file deploy/compose.vaapi.yaml up --detach --wait; \
else \
echo "Starting in CPU-only mode; $(RENDER_DEVICE) is unavailable"; \
$(COMPOSE) --file deploy/compose.cpu.yaml up --detach --wait; \
fi
packaging-down:
$(COMPOSE) down
test-vaapi:
ACCELERATION=vaapi go test -v ./internal/media -run '^TestVAAPIIntegration$$'
test-browser:
FILETWIST_TEST_IMAGE=$(IMAGE) npm --prefix tests/browser test