-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
156 lines (136 loc) · 4.18 KB
/
Makefile
File metadata and controls
156 lines (136 loc) · 4.18 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# SteerDock Makefile
# SteerDock 构建和部署工具
.PHONY: help build run clean test docker-build docker-run dev prod deps security lint fmt setup
# Default target
help:
@echo "SteerDock Build System"
@echo "========================"
@echo ""
@echo "Development:"
@echo " dev - Start development environment"
@echo " prod - Start production environment"
@echo " build - Build the application"
@echo " test - Run all tests"
@echo " clean - Clean build artifacts"
@echo ""
@echo "Docker:"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
@echo ""
@echo "Maintenance:"
@echo " deps - Update dependencies"
@echo " security - Run security scans"
@echo " lint - Lint code"
@echo " fmt - Format code"
@echo " setup - Setup development environment"
# Development environment
dev:
@echo "Starting development environment..."
@if [ "$(OS)" = "Windows_NT" ]; then \
powershell -ExecutionPolicy Bypass -File start-dev.ps1; \
else \
./start-dev.sh; \
fi
# Production environment
prod:
@echo "Starting production environment..."
@if [ "$(OS)" = "Windows_NT" ]; then \
powershell -ExecutionPolicy Bypass -File start-prod.ps1; \
else \
./start-prod.sh; \
fi
# Build the application
build:
@echo "Building frontend..."
cd frontend && npm ci && npm run build
@echo "Building backend..."
cd backend && go mod tidy && go build -o steerdock .
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf frontend/dist frontend/node_modules/.cache
rm -f backend/steerdock backend/steerdock.exe backend/coverage.out
cd frontend && npm run clean 2>/dev/null || true
cd backend && go clean -cache -modcache -testcache
# Run all tests
test:
@echo "Running tests..."
@echo "Frontend tests..."
cd frontend && npm ci && npm test -- --watchAll=false --coverage
@echo "Backend tests..."
cd backend && go test -v -race -coverprofile=coverage.out ./...
# Frontend tests only
test-frontend:
@echo "Running frontend tests..."
cd frontend && npm ci && npm test -- --watchAll=false --coverage
# Backend tests only
test-backend:
@echo "Running backend tests..."
cd backend && go test -v -race -coverprofile=coverage.out ./...
# Build Docker image
docker-build:
@echo "Building Docker image..."
docker build -t steerdock:latest .
# Run Docker container
docker-run:
@echo "Running Docker container..."
docker run -d \
--name steerdock \
-p 5151:5151 \
-p 8383:8383 \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
steerdock:latest
# Stop all services
stop:
@echo "Stopping all services..."
@if [ "$(OS)" = "Windows_NT" ]; then \
powershell -ExecutionPolicy Bypass -File stop-all.ps1; \
else \
./stop-all.sh; \
fi
# Update dependencies
deps:
@echo "Updating dependencies..."
cd frontend && npm update
cd backend && go get -u ./... && go mod tidy
# Security scans
security:
@echo "Running security scans..."
cd frontend && npm audit --audit-level high
cd backend && go list -json -m all | nancy sleuth || echo "Nancy not installed"
# Lint code
lint:
@echo "Linting code..."
cd frontend && npm run lint
cd backend && golangci-lint run || echo "golangci-lint not installed"
# Format code
fmt:
@echo "Formatting code..."
cd frontend && npm run lint --fix || true
cd backend && go fmt ./...
# Health check
health:
@echo "Checking application health..."
@curl -f http://localhost:8383/health/live || echo "Health check failed"
# View logs (Docker)
logs:
@echo "Viewing application logs..."
docker compose logs -f steerdock
# Development setup
setup: setup-scripts
@echo "Setting up development environment..."
@if [ "$(OS)" = "Windows_NT" ]; then \
powershell -ExecutionPolicy Bypass -File generate-passwords.ps1; \
else \
./generate-passwords.sh; \
fi
@echo "SteerDock development environment ready!"
@echo "Run 'make dev' to start development servers"
# Set up shell scripts (Linux/macOS only)
setup-scripts:
@if [ "$(shell uname)" != "MINGW64_NT" ] && [ "$(shell uname)" != "CYGWIN_NT" ]; then \
chmod +x start-dev.sh start-prod.sh stop-all.sh; \
echo "Shell scripts made executable"; \
else \
echo "Use PowerShell scripts on Windows"; \
fi