chores(deploy): ajouter targets go et docker pour Makefile

This commit is contained in:
Victor Lacasse-Beaudoin 2025-05-13 13:28:04 -04:00
parent 6d2dbf7e95
commit b3706080cd

View file

@ -4,13 +4,40 @@
.DEFAULT_GOAL := help
# splits current git annotated tag into 'MAJOR MINOR PATCH EXTRAS'.
# intended to be used as arguments for certain scripts requiring a semver as args
current_semver := $(shell git describe | tr -d 'v' | tr '.' ' ' | tr '-' ' ')
.PHONY: help
help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | \
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | \
sort | \
awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Use `docker build` to build the container image
docker build . -f Dockerfile -t git.agecem.com/bottin/presences:latest
.PHONY: go-install
go-install: ## Use `go install` to build and link the executable
go install -a
.PHONY: docker-build
docker-build: ## Build container image
#docker-compose build \
#--build-arg bottin_version=`git describe`
docker-compose build
.PHONY: docker-deploy
docker-deploy: ## Using `docker-compose up`, deploy the database and containers
docker-compose up -d
.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)
## pipelines
.PHONY: deploy
deploy: docker-build docker-deploy ## Build and deploy container image