-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (36 loc) · 1.27 KB
/
Copy pathMakefile
File metadata and controls
53 lines (36 loc) · 1.27 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
.PHONY: build test test-v lint fmt run clean smoke
BIN := bin/orchestrator
build:
go build -o $(BIN) ./cmd/orchestrator
test:
go test ./...
test-v:
go test -v ./...
test-race:
go test -race ./...
fmt:
go fmt ./...
goimports -w .
lint:
go vet ./...
run: build
./$(BIN)
clean:
rm -rf bin/ *.db *.db-wal *.db-shm coverage.out
GOARCH ?= $(shell go env GOARCH)
BIN_RUNNER_LINUX := bin/era-runner-linux
runner-linux:
GOOS=linux GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o $(BIN_RUNNER_LINUX) ./cmd/runner
BIN_SIDECAR_LINUX := bin/era-sidecar-linux
sidecar-linux:
GOOS=linux GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o $(BIN_SIDECAR_LINUX) ./cmd/sidecar
docker-runner: runner-linux sidecar-linux
docker build -t era-runner:m2 -f docker/runner/Dockerfile .
VPS_HOST ?= era@178.105.44.3
.PHONY: deploy
deploy: ## Rsync repo to VPS and restart service (runs go builds on VPS with native GOARCH)
rsync -az --delete \
--exclude bin/ --exclude pi-agent.db --exclude pi-agent.db-wal --exclude pi-agent.db-shm \
--exclude node_modules/ --exclude .env --exclude .git \
./ $(VPS_HOST):/opt/era/
ssh $(VPS_HOST) 'export PATH=/usr/local/go/bin:$$PATH && cd /opt/era && go env GOARCH && make build && make docker-runner && sudo systemctl restart era && sudo systemctl status era'