-
Notifications
You must be signed in to change notification settings - Fork 828
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (61 loc) · 1.91 KB
/
Copy pathMakefile
File metadata and controls
78 lines (61 loc) · 1.91 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
VERSION ?= 135.0.1
RELEASE ?= beta.24
# Auto-detect host architecture; map arm64 (macOS) → aarch64
UNAME_ARCH := $(shell uname -m)
ifeq ($(UNAME_ARCH),arm64)
ARCH ?= aarch64
else
ARCH ?= $(UNAME_ARCH)
endif
# Map ARCH to the platform suffixes used by upstream release filenames
ifeq ($(ARCH),aarch64)
CAMOUFOX_ARCH := arm64
YTDLP_ARCH := _aarch64
else
CAMOUFOX_ARCH := x86_64
YTDLP_ARCH :=
endif
IMAGE := camofox-browser:$(VERSION)-$(ARCH)
CAMOUFOX_ZIP := dist/camoufox-$(ARCH).zip
YTDLP_BIN := dist/yt-dlp-$(ARCH)
CAMOUFOX_URL := https://github.com/daijro/camoufox/releases/download/v$(VERSION)-$(RELEASE)/camoufox-$(VERSION)-$(RELEASE)-lin.$(CAMOUFOX_ARCH).zip
YTDLP_URL := https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux$(YTDLP_ARCH)
.PHONY: build build-arm64 build-x86 fetch fetch-arm64 fetch-x86 up down reset clean
## Build the Docker image for the current ARCH (default: x86_64)
build: fetch
docker build --no-cache \
--build-arg ARCH=$(ARCH) \
--build-arg CAMOUFOX_VERSION=$(VERSION) \
--build-arg CAMOUFOX_RELEASE=$(RELEASE) \
-t $(IMAGE) .
## Convenience targets
build-arm64:
$(MAKE) build ARCH=aarch64
build-x86:
$(MAKE) build ARCH=x86_64
## Download both binaries into dist/ for the current ARCH
fetch: $(CAMOUFOX_ZIP) $(YTDLP_BIN)
fetch-arm64:
$(MAKE) fetch ARCH=aarch64
fetch-x86:
$(MAKE) fetch ARCH=x86_64
$(CAMOUFOX_ZIP):
mkdir -p dist
curl -fSL "$(CAMOUFOX_URL)" -o $@
$(YTDLP_BIN):
mkdir -p dist
curl -fSL "$(YTDLP_URL)" -o $@
up:
@if ! docker image inspect $(IMAGE) > /dev/null 2>&1; then \
$(MAKE) build; \
fi
docker run -d --restart unless-stopped --name camofox-browser --shm-size=2g -p 9377:9377 $(IMAGE)
down:
docker stop camofox-browser && docker rm camofox-browser
reset:
-docker stop camofox-browser 2>/dev/null
-docker rm camofox-browser 2>/dev/null
-docker rmi $(IMAGE) 2>/dev/null
$(MAKE) build
clean:
rm -rf dist