forked from dokemon-ng/dokemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (88 loc) · 3.26 KB
/
Makefile
File metadata and controls
113 lines (88 loc) · 3.26 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
GO_VER_MIN ?= 1.23.3
.PHONY: help
default: help
lint: ## Apply gocilinter base on config rule
golangci-lint run -c .golangci.yml ./pkg/...
linter-fix: ## Auto fix some gocilinter issue
golangci-lint run --fix
build-server: ## Build server for production or local
@if [ "$(env-target)" = "prod" ]; then \
sudo docker buildx build --platform linux/amd64,linux/arm64 -t javastraat/dokemon-server:latest --push -f Dockerfile.server .; \
else \
sudo docker buildx build -t javastraat/dokemon-server:latest -f Dockerfile.server .; \
fi
build-agent: ## Build agent for production or local
@if [ "$(env-target)" = "prod" ]; then \
sudo docker buildx build --platform linux/amd64,linux/arm64 -t javastraat/dokemon-agent:latest --push -f Dockerfile.agent .; \
else \
sudo docker buildx build -t javastraat/dokemon-agent:latest -f Dockerfile.agent .; \
fi
run-server: ## Run Docker server locally
@docker stop dokemon-server || true
@docker rm dokemon-server || true
@docker run -d \
--name dokemon-server \
--restart unless-stopped \
-p 9090:9090 \
-v /dokemondata:/data \
-v /var/run/docker.sock:/var/run/docker.sock \
javastraat/dokemon-server:latest
run-traefik-compose: ## Run dokemon localy using traefik
sudo docker compose --env-file .env -f compose/dokemon-traefik-compose-dev.yml build \
&& sudo docker compose --env-file .env -f compose/dokemon-traefik-compose-dev.yml up -d
run-website: ## Run dokemon website localy
sudo docker compose --env-file .env -f compose/dokemon-website.yml build \
&& sudo docker compose --env-file .env -f compose/dokemon-website.yml up -d
run-agent: ## Build and run the Docker agent locally
@rm -f ./agent
@echo "🔧 Building agent..."
@go build -o agent ./cmd/agent
@echo "🚀 Running agent..."
@SERVER_URL="http://192.168.1.7:9090" \
LOG_LEVEL="DEBUG" \
./agent
runserver: ## Build and run the server locally
@echo "🧹 Cleaning up previous build..."
@rm -f ./server
@echo "🌐 Building web frontend..."
@cd web && npm run build
@echo "🔧 Building Go server..."
@go build -o server ./cmd/server
@echo "🚀 Starting server..."
@DB_CONNECTION_STRING="/tmp/db" \
DATA_PATH="/tmp" \
LOG_LEVEL="DEBUG" \
SSL_ENABLED="0" \
./server
install-eletrize: ## install eletrize for live go server reload
go install github.com/lasfh/eletrize@latest
export PATH="$PATH:$(go env GOPATH)/bin"
@echo "install eletrize successfully.."
start: ## Build and run the server with live reload (for dev purpose only)
@echo "🧹 Cleaning up previous build..."
@rm -f ./server
@echo "🌐 Building web frontend..."
@cd web && npm run build
@DB_CONNECTION_STRING="/tmp/db" \
DATA_PATH="/tmp" \
LOG_LEVEL="DEBUG" \
SSL_ENABLED="0" \
eletrize run ./server "go build -o server ./cmd/server" --ext=.go,.mod,.tsx
update-go-mod: ## Update go mod
cp go.mod go.mod.bak
cp go.sum go.sum.bak
@echo '* Updating modules ...'
go get -u ./...
@echo '* Removing old go.mod file ...'
rm -f go.mod.bak
rm -f go.sum.bak
@echo 'Successfully updated modules!'
help:
@echo "usage: make [command]"
@echo ""
@echo "dokemon-ng available commands 🐳:"
@sed \
-e '/^[a-zA-Z0-9_\-]*:.*##/!d' \
-e 's/:.*##\s*/:/' \
-e 's/^\(.\+\):\(.*\)/$(shell tput setaf 6)\1$(shell tput sgr0):\2/' \
$(MAKEFILE_LIST) | column -c2 -t -s :