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/