-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (43 loc) · 1.62 KB
/
Makefile
File metadata and controls
62 lines (43 loc) · 1.62 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
APP_NAME := habits
VERSION ?= $(shell git describe --tags --dirty --always)
BUILD ?= $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS := -X 'github.com/brk3/habits/pkg/versioninfo.Version=$(VERSION)' -X 'github.com/brk3/habits/pkg/versioninfo.BuildDate=$(BUILD)'
BIN_DIR := dist
.PHONY: all build test fmt vet lint clean server frontend docker-up docker-down docker-restart docker-logs
all: fmt vet lint test build
build:
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(APP_NAME) main.go
build-linux:
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(APP_NAME)-linux main.go
build-linux-arm64:
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(APP_NAME)-linux-arm64 main.go
build-macos:
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(APP_NAME)-macos main.go
build-windows:
GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(APP_NAME).exe main.go
build-all: build-linux build-linux-arm64 build-macos build-windows
clean:
rm -rf bin $(BIN_DIR)
test:
go test -cover ./...
fmt:
go fmt ./...
vet:
go vet ./...
lint:
staticcheck ./...
server:
env -i PATH="$$PATH" HOME="$$HOME" go run main.go server
frontend:
cd frontend && npm run dev
# Docker compose commands for extras stack
docker-up:
docker compose -f extras/docker-compose.yml up -d
docker-down:
docker compose -f extras/docker-compose.yml down
docker-restart:
docker compose -f extras/docker-compose.yml down
docker compose -f extras/docker-compose.yml pull
docker compose -f extras/docker-compose.yml up -d
docker-logs:
docker compose -f extras/docker-compose.yml logs -f