agecem-org/Makefile
Victor Lacasse-Beaudoin 23a6bb104b fix(make): renommer targets selon projet utilisé
Préfixes go- et docker- ajoutés à la majorité des targets
2025-05-06 19:00:21 -04:00

46 lines
1.6 KiB
Makefile

.DEFAULT_GOAL := help
current_semver := $(shell git describe | tr -d 'v' | tr '.' ' ' | tr '-' ' ')
.PHONY: help
help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | \
sort | \
awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: go-build
go-build: ## Build agecem-org executable
CGO_ENABLED=0 go build -a -o agecem-org \
-ldflags="-X 'git.agecem.com/agecem/agecem-org/pkg/agecemorg/version.version=`git describe`'" ./cmd/agecemorg/
.PHONY: install
go-install: ## Using `go install`, install the agecem-org executable at ~/go/bin/haul
CGO_ENABLED=0 go install -a \
-ldflags="-X 'git.agecem.com/agecem/agecem-org/pkg/agecemorg/version.version=`git describe`'" ./cmd/agecemorg/
.PHONY: go-run
go-run: ## Run agecem-org from source with `go run`
CGO_ENABLED=0 go run \
-ldflags="-X 'git.agecem.com/agecem/agecem-org/pkg/agecemorg/version.version=`git describe`'" ./cmd/agecemorg/
.PHONY: docker-build
docker-build: ## Build agecem-org container image
docker-compose build \
--build-arg agecem_org_version=`git describe`
.PHONY: docker-deploy
docker-deploy: ## Using `docker-compose up`, deploy the database and agecem-org containers
docker-compose up -d
.PHONY: deploy
deploy: docker-build docker-deploy ## Build and deploy agecem-org container image
.PHONY: docker-tag-from-git
docker-tag-from-git: ## Tag latest image according to annotated tag from `git describe`
./scripts/docker-tag.sh $(current_semver)
.PHONY: docker-push-from-git
docker-push-from-git: ## Push images to git.agecem.com according to annotated tag from `git describe`
./scripts/docker-push.sh $(current_semver)