-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (46 loc) · 1.13 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
GOC=go build
GOFLAGS=-a -ldflags '-s'
CGOR=CGO_ENABLED=0
OS_PERMS=sudo
CWD=$(shell pwd)
GIT_HASH=$(shell git rev-parse HEAD | head -c 10)
FULL_DOCKER_NAME=unixvoid/bitnuke
all: bitnuke
dependencies:
go mod init github.com/unixvoid/bitnuke
go mod tidy
daemon:
bin/bitnuke &
bitnuke:
$(GOC) bitnuke.go
run:
go run \
bitnuke/bitnuke.go \
bitnuke/dynamic_handler.go \
bitnuke/link_compressor.go \
bitnuke/remove.go \
bitnuke/token_generator.go \
bitnuke/upload.go
docker: clean stat
rm -rf stage.tmp/
mkdir -p stage.tmp/
cp deps/Dockerfile-bitnuke stage.tmp/Dockerfile
cp bin/bitnuke* stage.tmp/bitnuke
cd stage.tmp/ && \
$(OS_PERMS) docker build -t $(FULL_DOCKER_NAME) .
run-stack:
cd deps/ && \
$(OS_PERMS) docker-compose up -d && \
$(OS_PERMS) docker-compose logs -f
restart-stack:
cd deps/ && \
$(OS_PERMS) docker-compose down && \
$(OS_PERMS) docker rm `sudo docker ps -aq` 2> /dev/null && \
$(OS_PERMS) docker-compose up -d && \
$(OS_PERMS) docker-compose logs -f
stat:
mkdir -p bin/
$(CGOR) $(GOC) $(GOFLAGS) -o bin/bitnuke-$(GIT_HASH)-linux-amd64 bitnuke/*.go
clean:
rm -rf bin/
rm -rf stage.tmp/