-
Notifications
You must be signed in to change notification settings - Fork 57
/
justfile
41 lines (34 loc) · 1.13 KB
/
justfile
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
VERSION := shell("toml get zeronsd/Cargo.toml package.version")
DOCKER_TAG := "zeronsd:" + VERSION
DOCKER_BIN := env_var_or_default("DOCKER_BIN", "docker")
version:
@echo {{VERSION}}
docker:
@echo {{DOCKER_BIN}}
build:
nix build
docker-build platform="linux/arm64,linux/amd64":
{{DOCKER_BIN}} build \
--platform={{platform}} \
-t {{DOCKER_TAG}} \
.
clean-image:
{{DOCKER_BIN}} image rm {{DOCKER_TAG}}
resolve network name:
nix run nixpkg#dig @$(zerotier-cli -j listnetworks \
| jq -r \
'.[] | select(.id == "{{network}}") \
| .dns.servers \
| select(.[] | test("\\d+\\.\\d+\\.\\d+\\.\\d+")) \
| last') \
{{name}}
run network config="./config.yaml" token="./.central.token" docker-bin="docker": build
file {{config}}
sudo {{DOCKER_BIN}} run \
--net=host \
--init \
-v {{config}}:/var/lib/zeronsd/config.yaml \
-v {{token}}:/var/lib/zeronsd/central.token \
-v /var/lib/zerotier-one:/var/lib/zerotier-one \
zerotier/{{DOCKER_TAG}} \
zeronsd start -c /var/lib/zeronsd/config.yaml {{network}}