Files
lodge/backend/Makefile
T

36 lines
821 B
Makefile

COMPOSE := cd .. && docker compose
IMAGE := lodge/backend
LINT := go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null
stamp = { git update-ref $(1) HEAD 2>/dev/null || true; }
.PHONY: fmt check test build pre-deploy post-deploy client dev
fmt:
go mod tidy
$(LINT) fmt
check:
$(LINT) run
$(MAKE) test
test:
go test -race ./...
build:
$(COMPOSE) build api
pre-deploy:
@if $(call changed,refs/deploy/backend,.) || ! docker image inspect $(IMAGE) >/dev/null 2>&1; then \
$(MAKE) build && $(call stamp,refs/deploy/backend); \
fi
post-deploy:
@:
client:
go build -trimpath -ldflags "-s -w" -o bin/lodge ./cmd/lodge
dev:
LODGE_DB=storage/lodge.db STATIC_DIR=../frontend/build CLIENTS_DIR=bin ADMIN_TOKEN=dev go run ./cmd/lodge-server