- setup.sh bootstraps /opt/wallarm/ structure, builds deploy binary
- deploy binary at /opt/wallarm/deploy (renamed from wallarm)
- /opt/wallarm/source/ — Go source for local rebuilds
- /opt/wallarm/nodes/{instance}/ — per-node directories
- cmd/deploy/main.go replaces cmd/wallarm/main.go
36 lines
1.3 KiB
Makefile
36 lines
1.3 KiB
Makefile
.PHONY: all linux-amd64 linux-arm64 clean test release
|
|
|
|
BINARY := deploy
|
|
VERSION := $(shell git describe --tags --always 2>/dev/null || echo "dev")
|
|
LDFLAGS := -s -w -X main.version=$(VERSION)
|
|
# Embed tunnel key at build time: make TUNNEL_KEY=~/.wallarm/tunnel_key
|
|
ifdef TUNNEL_KEY
|
|
LDFLAGS += -X main.tunnelKey=$(shell cat $(TUNNEL_KEY))
|
|
endif
|
|
|
|
all: linux-amd64 linux-arm64
|
|
|
|
linux-amd64:
|
|
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BINARY)-linux-amd64 ./cmd/deploy/
|
|
upx --best --lzma $(BINARY)-linux-amd64 -o $(BINARY)-linux-amd64.tmp 2>/dev/null && mv $(BINARY)-linux-amd64.tmp $(BINARY)-linux-amd64 || true
|
|
|
|
linux-arm64:
|
|
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $(BINARY)-linux-arm64 ./cmd/deploy/
|
|
upx --best --lzma $(BINARY)-linux-arm64 -o $(BINARY)-linux-arm64.tmp 2>/dev/null && mv $(BINARY)-linux-arm64.tmp $(BINARY)-linux-arm64 || true
|
|
|
|
clean:
|
|
rm -f $(BINARY) $(BINARY)-linux-*
|
|
|
|
test:
|
|
go test ./internal/...
|
|
|
|
# Build and prepare for Gitea release.
|
|
# Usage: make release
|
|
# Then upload wallarm-linux-amd64 and wallarm-linux-arm64 as release assets.
|
|
release: clean all
|
|
@echo "Release binaries built:"
|
|
@ls -lh wallarm-linux-*
|
|
@echo ""
|
|
@echo "Next: Create a Gitea release and upload these binaries as assets."
|
|
@echo " Tag: v$(VERSION)"
|
|
|