zadmin/Makefile
2024-12-14 14:44:37 +01:00

56 lines
1.5 KiB
Makefile

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/"
build-server: $(GO_FILES)
mkdir -p build
CGO_ENABLED=0 go build -o build/zadmin-server ./cmd/server/main.go
build-client: $(GO_FILES)
mkdir -p build
CGO_ENABLED=0 go build -o build/zadmin-client ./cmd/client/main.go
docker-up:
mkdir -p ./tmp
docker compose -f ./deployments/compose-dev.yaml up -d
docker-down:
docker compose -f ./deployments/compose-dev.yaml down
docker-clean: docker-down
docker volume rm -f deployments_pg_data
rm -rf ./tmp
server: build-server
./build/zadmin-server
client: build-client
./build/zadmin-client
clean:
rm -r build
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