zadmin/Makefile

56 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2024-12-14 14:44:37 +01:00
GO_FILES := $(shell find . -name '*.go' -not -path './build/*' -not -path './tmp/**')
GOOSE_DBSTRING := "user=zadmin_user password=s3cret! dbname=zadmin_dev sslmode=disable host=localhost"
GOOSE_MIGRATION_PATH := "./db/migrations/"
GOOSE_SEED_PATH := "./db/seed/"
2024-12-05 19:50:21 +01:00
build-server: $(GO_FILES)
mkdir -p build
2024-12-14 14:44:37 +01:00
CGO_ENABLED=0 go build -o build/zadmin-server ./cmd/server/main.go
2024-12-05 19:50:21 +01:00
build-client: $(GO_FILES)
mkdir -p build
2024-12-14 14:44:37 +01:00
CGO_ENABLED=0 go build -o build/zadmin-client ./cmd/client/main.go
2024-12-05 16:22:48 +01:00
docker-up:
mkdir -p ./tmp
2024-12-05 19:50:21 +01:00
docker compose -f ./deployments/compose-dev.yaml up -d
2024-12-05 16:22:48 +01:00
docker-down:
docker compose -f ./deployments/compose-dev.yaml down
docker-clean: docker-down
2024-12-14 14:44:37 +01:00
docker volume rm -f deployments_pg_data
2024-12-05 16:22:48 +01:00
rm -rf ./tmp
2024-12-05 19:50:21 +01:00
server: build-server
./build/zadmin-server
2024-12-05 19:50:21 +01:00
client: build-client
./build/zadmin-client
clean:
rm -r build
2024-12-14 14:44:37 +01:00
install-goose:
go install github.com/pressly/goose/v3/cmd/goose@latest
db-status:
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(GOOSE_DBSTRING) goose -dir=$(GOOSE_MIGRATION_PATH) status
db-up:
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(GOOSE_DBSTRING) goose -dir=$(GOOSE_MIGRATION_PATH) up
db-reset:
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(GOOSE_DBSTRING) goose -dir=$(GOOSE_MIGRATION_PATH) reset
goose-custom:
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(GOOSE_DBSTRING) goose -dir=$(GOOSE_MIGRATION_PATH) $(cmd)
goose-seed-custom:
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(GOOSE_DBSTRING) goose -dir=$(GOOSE_SEED_PATH) $(cmd)
db-seed:
echo "TODO"
.PHONY: clean run-server run-client docker-up docker-down docker-clean server client install-goose