-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathMakefile
36 lines (31 loc) · 1.14 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
NAME=synapse
VERSION=$(shell git rev-parse HEAD)
SEMVER_VERSION=$(shell grep version Cargo.toml | awk -F"\"" '{print $$2}' | head -n 1)
REPO=luminarys
compile:
docker run --rm \
-v cargo-cache:/root/.cargo \
-v $$PWD:/volume \
-w /volume \
-it clux/muslrust:stable \
cargo build --locked --release --all
sudo chown $$USER:$$USER -R target
strip target/x86_64-unknown-linux-musl/release/synapse
strip target/x86_64-unknown-linux-musl/release/sycli
build:
docker build -t $(REPO)/$(NAME):$(VERSION) . -f Dockerfile.musl
run:
mkdir -p ~/Downloads/synapse
sudo chown 1000:1000 -R ~/Downloads/synapse
docker run \
-v ~/Downloads/synapse:/synapse/downloads \
-t $(REPO)/$(NAME):$(VERSION)
tag-latest: build
docker tag $(REPO)/$(NAME):$(VERSION) $(REPO)/$(NAME):latest
docker push $(REPO)/$(NAME):latest
tag-semver: build
if curl -sSL https://registry.hub.docker.com/v1/repositories/$(REPO)/$(NAME)/tags | jq -r ".[].name" | grep -q $(SEMVER_VERSION); then \
echo "Tag $(SEMVER_VERSION) already exists" && exit 1 ;\
fi
docker tag $(REPO)/$(NAME):$(VERSION) $(REPO)/$(NAME):$(SEMVER_VERSION)
docker push $(REPO)/$(NAME):$(SEMVER_VERSION)