-
-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (64 loc) · 2.25 KB
/
Makefile
File metadata and controls
75 lines (64 loc) · 2.25 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
# Build variables
BINARY_NAME=netronome
BUILD_DIR=bin
DOCKER_IMAGE=netronome
.PHONY: all build clean run docker-build docker-run watch dev dev-expose lint
all: build
build:
@echo "Building frontend and backend..."
@mkdir -p $(BUILD_DIR)
@mkdir -p web/dist
@cd web && pnpm install && pnpm build
@touch web/dist/.gitkeep
@go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/netronome
clean:
@echo "Cleaning up..."
@rm -rf $(BUILD_DIR)
@rm -rf web/dist
@mkdir -p web/dist
@touch web/dist/.gitkeep
@rm -rf web/node_modules
run: build
@echo "Running application..."
@./$(BUILD_DIR)/$(BINARY_NAME) serve --config config/config.toml
docker-build:
@echo "Building Docker image..."
docker build -f distrib/docker/Dockerfile -t $(DOCKER_IMAGE) .
docker-run: docker-build
@echo "Running Docker container..."
docker run -p 7575:7575 $(DOCKER_IMAGE)
# Development with live reload
dev:
@echo "Starting development servers..."
@GIN_MODE=debug tmux new-session -d -s dev 'cd web && pnpm dev'
@touch web/dist/.gitkeep > /dev/null 2>&1
@GIN_MODE=debug tmux split-window -h 'make watch'
@tmux -2 attach-session -d
# Development with live reload exposed on network
dev-expose:
@echo "Starting development servers (exposed on network)..."
@echo "Frontend will be available at http://0.0.0.0:5173"
@echo "Backend will be available at http://0.0.0.0:7575"
@echo "You can access from other devices using your machine's IP address"
@GIN_MODE=debug tmux new-session -d -s dev 'cd web && pnpm dev --host 0.0.0.0'
@touch web/dist/.gitkeep > /dev/null 2>&1
@GIN_MODE=debug tmux split-window -h 'make watch'
@tmux -2 attach-session -d
watch:
@if command -v air > /dev/null; then \
GIN_MODE=debug air -c .config/air.toml -- serve --config config/config.toml; \
echo "Watching...";\
else \
read -p "Go's 'air' is not installed on your machine. Do you want to install it? [Y/n] " choice; \
if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \
go install github.com/cosmtrek/air@latest; \
GIN_MODE=debug air -c .config/air.toml -- serve --config config/config.toml; \
echo "Watching...";\
else \
echo "You chose not to install air. Exiting..."; \
exit 1; \
fi; \
fi
lint:
@echo "Linting changed Go code..."
golangci-lint run --new-from-merge-base=develop --timeout=5m