-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (41 loc) · 1.95 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
56
include .env.example
GOFUMPT=gofumpt -l -w
.PHONY:
.DEFAULT_GOAL := help
#thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
build: ## Builds the binary
@echo "Building import binary"
go build -o bin/importer cmd/importer/main.go
build-storelinks: ## Builds the binary
@echo "Building storelinks binary"
go build -o bin/storelinks cmd/storelinks/main.go
build-linksapi: ## Builds the binary
@echo "Building linksapi binary"
go build -o bin/linksapi cmd/linksapi/main.go
lint: $(GOLANGCI) ## Runs golangci-lint with predefined configuration
@echo "Applying linter"
golangci-lint version
golangci-lint run -c .golangci.toml ./...
test: ## Runs the tests
@echo "Running tests"
go test -v -cover ./...
help: ## Display this help screen
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
compose-up: ## Starts the docker-compose, example make compose-up ARCHIVENAME="CC-MAIN-2021-04"
@echo "Starting docker-compose"
ARCHIVENAME=${ARCHIVENAME} GLOBALLINKS_MAXWATFILES=${GLOBALLINKS_MAXWATFILES} GLOBALLINKS_MAXTHREADS=${GLOBALLINKS_MAXTHREADS} docker-compose up -d --build watimport
compose-down: ## Stops the docker-compose
@echo "Stopping docker-compose"
docker-compose down
docker-rm-volumes: ## Removes all docker volumes
@echo "Removing all docker volumes"
docker volume rm $$(docker volume ls -qf dangling=true)
docker-build: ## Builds the Docker image
@echo "Building Docker image"
docker build -t watlinksapp .
docker-start: ## Starts the Docker container
@echo "Starting Docker container"
docker run -d -v ./watdata:/app/data watlinksapp /app/importer $(ARCHIVENAME) $(GLOBALLINKS_MAXWATFILES) $(GLOBALLINKS_MAXTHREADS)
docker-stop: ## Stops the Docker container
@echo "Stopping Docker container"
docker stop $$(docker ps -q --filter ancestor=watlinksapp)