forked from ItalyPaleAle/tailsocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (55 loc) · 1.84 KB
/
Copy pathMakefile
File metadata and controls
70 lines (55 loc) · 1.84 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
SHELL := /bin/bash
GO ?= go
BIN ?= flotilla
PKG := github.com/mamidevs/flotilla
LDFLAGS ?= -s -w \
-X $(PKG)/internal/buildinfo.AppVersion=$(shell git describe --tags --always --dirty 2>/dev/null || echo dev) \
-X $(PKG)/internal/buildinfo.CommitHash=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) \
-X $(PKG)/internal/buildinfo.BuildDate=$(shell date -u +%Y-%m-%dT%H:%M:%SZ) \
-X $(PKG)/internal/buildinfo.BuildId=make \
-X $(PKG)/internal/buildinfo.Production=1
.PHONY: help build run test lint tidy fmt vet clean docker docker-up docker-down example
help:
@echo "flotilla — Makefile"
@echo ""
@echo "Common targets:"
@echo " make build Build ./$(BIN)"
@echo " make run Run with examples/single-node.yaml (needs Tailnet)"
@echo " make test go test -race ./..."
@echo " make lint golangci-lint run"
@echo " make tidy go mod tidy"
@echo " make vet go vet ./..."
@echo " make fmt gofmt -s -w ."
@echo ""
@echo "Docker:"
@echo " make docker Build local container image"
@echo " make docker-up docker compose up -d"
@echo " make docker-down docker compose down"
@echo ""
@echo "Scaffold:"
@echo " make example flotilla init -o flotilla.yaml"
build:
CGO_ENABLED=0 $(GO) build -trimpath -ldflags='$(LDFLAGS)' -o ./$(BIN) ./cmd/flotilla
run: build
./$(BIN) run --config examples/single-node.yaml
test:
$(GO) test -race -count=1 ./...
lint:
golangci-lint run
tidy:
$(GO) mod tidy
fmt:
gofmt -s -w .
vet:
$(GO) vet ./...
clean:
rm -f ./$(BIN)
rm -rf ./state ./tsnet-state ./flotilla-state
docker:
docker build -t flotilla:dev .
docker-up:
docker compose up -d
docker-down:
docker compose down
example: build
./$(BIN) init -o flotilla.yaml