File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44# binaries
55/tinyauth
6+ /tinyauth-arm64
7+ /tinyauth-amd64
68
79# test docker compose
810/docker-compose.test *
2224# tmp directory
2325/tmp
2426
25- # version files
26- /internal /assets /version
27-
2827# data directory
2928/data
3029
3635/resources
3736
3837# debug files
39- __debug_ *
38+ __debug_ *
Original file line number Diff line number Diff line change 1+ # Go specific stuff
2+ CGO_ENABLED := 0
3+ GOOS := $(shell go env GOOS)
4+ GOARCH := $(shell go env GOARCH)
5+
6+ # Build out
7+ TAG_NAME := $(shell git describe --abbrev=0 --exact-match 2> /dev/null || echo "main")
8+ COMMIT_HASH := $(shell git rev-parse HEAD)
9+ BUILD_TIMESTAMP := $(shell date '+% Y-% m-% dT% H:% M:% S')
10+ BIN_NAME := tinyauth-$(GOARCH )
11+
12+ # Development vars
13+ DEV_COMPOSE := $(shell test -f "docker-compose.test.yml" && echo "docker-compose.test.yml" || echo "docker-compose.yml" )
14+ PROD_COMPOSE := $(shell test -f "docker-compose.test.prod.yml" && echo "docker-compose.test.prod.yml" || echo "docker-compose.example.yml" )
15+
16+ # Deps
17+ deps :
18+ bun install --cwd frontend
19+ go mod download
20+
21+ # Clean web UI build
22+ clean-webui :
23+ rm -rf internal/assets/dist
24+ rm -rf frontend/dist
25+
26+ # Build the web UI
27+ webui : clean-webui
28+ bun run --cwd frontend build
29+ cp -r frontend/dist internal/assets
30+
31+ # Build the binary
32+ binary : webui
33+ CGO_ENABLED=$(CGO_ENABLED ) go build -ldflags " -s -w \
34+ -X tinyauth/internal/config.Version=${TAG_NAME} \
35+ -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} \
36+ -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP} " \
37+ -o ${BIN_NAME} ./cmd/tinyauth
38+
39+ # Build for amd64
40+ binary-linux-amd64 :
41+ export BIN_NAME=tinyauth-amd64
42+ export GOARCH=amd64
43+ export GOOS=linux
44+ $(MAKE ) binary
45+
46+ # Build for arm64
47+ binary-linux-arm64 :
48+ export BIN_NAME=tinyauth-arm64
49+ export GOARCH=arm64
50+ export GOOS=linux
51+ $(MAKE ) binary
52+
53+ # Go test
54+ .PHONY : test
55+ test :
56+ go test -v ./...
57+
58+ # Development
59+ develop :
60+ docker compose -f $(DEV_COMPOSE ) up --force-recreate --pull=always --remove-orphans
61+
62+ # Production
63+ prod :
64+ docker compose -f $(PROD_COMPOSE ) up --force-recreate --pull=always --remove-orphans
You can’t perform that action at this time.
0 commit comments