GOPATH ?= $(HOME)/.local/share/go WAILS := $(GOPATH)/bin/wails SERVER := root@178.20.40.99 export GOPATH .PHONY: all server client-linux client-windows installer test clean deploy release all: server client-linux # --- Server --- server: go build -o build/vpnem-server ./cmd/server # --- Client --- client-linux: cd cmd/client && $(WAILS) build -platform linux/amd64 -o vpnem -tags with_gvisor cp cmd/client/build/bin/vpnem build/vpnem-linux-amd64 client-windows: cd cmd/client && CC=x86_64-w64-mingw32-gcc $(WAILS) build -platform windows/amd64 -o vpnem.exe -tags with_gvisor cp cmd/client/build/bin/vpnem.exe build/vpnem-windows-amd64.exe installer: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-H windowsgui" -o build/vpnem-installer.exe ./cmd/installer # --- Test --- test: go test ./... -v # --- Deploy: server code only --- deploy: rsync -avz --exclude '.git' --exclude 'build' --exclude '*.srs' --exclude '.claude' \ ./ $(SERVER):/opt/vpnem/ ssh $(SERVER) "cd /opt/vpnem && docker compose up -d --build" @echo "Verify: curl https://vpn.em-sysadmin.xyz/health" # --- Release: build all + deploy binaries + bump version --- release: client-linux client-windows installer rm -f build/vpnem-linux-amd64 cp cmd/client/build/bin/vpnem build/vpnem-linux-amd64 scp build/vpnem-linux-amd64 build/vpnem-windows-amd64.exe build/vpnem-installer.exe \ $(SERVER):/opt/vpnem/data/releases/ scp data/version.json $(SERVER):/opt/vpnem/data/version.json rsync -avz --exclude '.git' --exclude 'build' --exclude '*.srs' --exclude '.claude' \ ./ $(SERVER):/opt/vpnem/ ssh $(SERVER) "cd /opt/vpnem && docker compose restart" @echo "" @curl -s https://vpn.em-sysadmin.xyz/api/v1/version @echo "" @echo "Release deployed." # --- Clean --- clean: rm -rf build/ cmd/client/build/