-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (79 loc) · 3.3 KB
/
Makefile
File metadata and controls
90 lines (79 loc) · 3.3 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
# Lambda NAT Proxy - Makefile
# Simple build and test operations
# Build configuration
BUILD_DIR := build
LAMBDA_PROXY_BIN := $(BUILD_DIR)/lambda-nat-proxy
LAMBDA_BOOTSTRAP := $(BUILD_DIR)/bootstrap
.PHONY: help build test e2e clean tidy
# Default target
all: build
help: ## Show this help
@echo "Lambda NAT Proxy - Build & Test"
@echo ""
@echo "Build Options:"
@echo " make build Build locally (requires Node.js + Go)"
@echo " make docker-build Build using Docker (no local deps needed)"
@echo " make build-all Build for all platforms using Docker"
@echo ""
@echo "Development:"
@echo " make test Run all tests"
@echo " make e2e Run end-to-end connectivity test"
@echo " make clean Remove build artifacts"
@echo " make tidy Tidy Go modules"
@echo ""
@echo "CLI Usage:"
@echo " ./build/lambda-nat-proxy deploy Deploy infrastructure"
@echo " ./build/lambda-nat-proxy run Start proxy with dashboard"
@echo " ./build/lambda-nat-proxy status Check deployment status"
@echo " ./build/lambda-nat-proxy destroy Remove all resources"
build: ## Build lambda-nat-proxy CLI with embedded Lambda function and dashboard
@echo "Building dashboard frontend..."
@./scripts/build-dashboard.sh
@echo "Building Lambda function..."
@mkdir -p $(BUILD_DIR)
@mkdir -p cmd/lambda-nat-proxy/assets
@cd lambda && GOOS=linux GOARCH=amd64 go build -o ../cmd/lambda-nat-proxy/assets/bootstrap .
@chmod +x cmd/lambda-nat-proxy/assets/bootstrap
@echo "✅ Built: cmd/lambda-nat-proxy/assets/bootstrap"
@echo "Building lambda-nat-proxy CLI with embedded Lambda and dashboard..."
@go build -o $(LAMBDA_PROXY_BIN) ./cmd/lambda-nat-proxy
@echo "✅ Built: $(LAMBDA_PROXY_BIN) (with embedded Lambda function and dashboard)"
@echo "Copying bootstrap to build directory for consistency..."
@cp cmd/lambda-nat-proxy/assets/bootstrap $(LAMBDA_BOOTSTRAP)
@echo "✅ Built: $(LAMBDA_BOOTSTRAP)"
docker-build: ## Build using Docker (no local dependencies required)
@echo "🐳 Building with Docker (includes all dependencies)..."
@./scripts/docker-build.sh
build-all: ## Build for multiple platforms using Docker
@echo "🌍 Building for multiple platforms using Docker..."
@./scripts/docker-build-all.sh
test: ## Run all tests
@echo "Running all tests..."
@echo "Building dashboard for embedded tests..."
@./scripts/build-dashboard.sh
@echo "Building Lambda function for embedded tests..."
@mkdir -p $(BUILD_DIR)
@mkdir -p cmd/lambda-nat-proxy/assets
@cd lambda && GOOS=linux GOARCH=amd64 go build -o ../cmd/lambda-nat-proxy/assets/bootstrap .
@chmod +x cmd/lambda-nat-proxy/assets/bootstrap
@go test -v ./...
@echo "✅ All tests passed"
e2e: build ## Run end-to-end connectivity test
@echo "Running end-to-end tests..."
@cd test/e2e && go test -v .
@echo "✅ End-to-end tests passed"
clean: ## Remove build artifacts
@echo "Cleaning build directory..."
@rm -rf $(BUILD_DIR)
@echo "Cleaning embedded assets..."
@rm -rf cmd/lambda-nat-proxy/assets
@echo "Cleaning dashboard build artifacts..."
@rm -rf web/dist
@rm -rf internal/dashboard/web
@echo "✅ Build artifacts removed"
tidy: ## Tidy Go modules
@echo "Tidying Go modules..."
@go mod tidy
@cd lambda && go mod tidy
@cd test/e2e && go mod tidy
@echo "✅ Go modules tidied"