-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (35 loc) · 964 Bytes
/
Copy pathMakefile
File metadata and controls
47 lines (35 loc) · 964 Bytes
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
BINARY := glsync
BUILD_DIR := bin
CONFIG ?= config/glsync.yaml
DB_URL ?= postgres://glsync:glsync@localhost:5432/glsync?sslmode=disable
# Load .env file if it exists
-include .env
export
.PHONY: build test lint run docker-build migrate-up migrate-down
build:
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BINARY) ./cmd/glsync
test:
go test ./... -race -count=1
lint:
golangci-lint run ./...
run: build
./$(BUILD_DIR)/$(BINARY) -config $(CONFIG)
migrate-up:
migrate -path migrations -database "$(DB_URL)" up
migrate-down:
migrate -path migrations -database "$(DB_URL)" down 1
migrate-status:
migrate -path migrations -database "$(DB_URL)" version
docker-build:
docker build -t $(BINARY):latest .
# Create local dev database (requires Docker)
dev-db:
docker run -d --name glsync-pg \
-e POSTGRES_USER=glsync \
-e POSTGRES_PASSWORD=glsync \
-e POSTGRES_DB=glsync \
-p 5432:5432 \
postgres:16-alpine
tidy:
go mod tidy