Feat: add healthz
This commit is contained in:
14
Makefile
14
Makefile
@@ -3,6 +3,7 @@
|
||||
|
||||
SWAG ?= go run github.com/swaggo/swag/cmd/swag@v1.16.4
|
||||
DOCKER ?= docker
|
||||
COMPOSE ?= $(DOCKER) compose -p go2025-backend
|
||||
|
||||
GO_ENV += CGO_ENABLED=0
|
||||
SOURCE := $(shell find . -type f -name '*.go')
|
||||
@@ -15,7 +16,7 @@ swagger:
|
||||
$(SWAG) init -o docs -g cmds/serve.go -pdl 1
|
||||
|
||||
docker: $(TARGET)
|
||||
$(DOCKER) compose up -d --force-recreate --build backend
|
||||
$(COMPOSE) up -d --force-recreate --build backend
|
||||
|
||||
$(TARGET): $(SOURCE)
|
||||
$(GO_ENV) go build -o $@
|
||||
@@ -27,16 +28,19 @@ test:
|
||||
go test -v ./tests -count=1 -failfast
|
||||
|
||||
postgres:
|
||||
$(DOCKER) compose exec postgres psql \
|
||||
$(COMPOSE) exec postgres psql \
|
||||
postgres://go2025:go2025@postgres:5432/go2025?sslmode=disable
|
||||
|
||||
test-ci: docker-quiet test docker-clean
|
||||
|
||||
docker-quiet: $(TARGET)
|
||||
$(DOCKER) compose -p go2025-backend up -d \
|
||||
$(COMPOSE) up -d \
|
||||
--force-recreate --build backend \
|
||||
--quiet-build --quiet-pull
|
||||
sleep 5
|
||||
-for i in seq 10; do \
|
||||
$(COMPOSE) exec postgres docker-ensure-initdb.sh && break; \
|
||||
sleep 1; \
|
||||
done
|
||||
|
||||
docker-clean:
|
||||
$(DOCKER) compose -p go2025-backend down -v --remove-orphans
|
||||
$(COMPOSE) down -v --remove-orphans
|
||||
|
||||
Reference in New Issue
Block a user