add commit SHA build argument to frontend Docker builds in pre-push hook and Makefile, and introduce version bumping targets for release workflow
Some checks failed
Build and Push Docker Images / build-backend (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled

This commit is contained in:
Egor Pozharov
2026-05-05 14:40:27 +06:00
parent c39bde0b10
commit 48a32d50fd
4 changed files with 25 additions and 8 deletions

View File

@@ -1,15 +1,17 @@
# Delivery Tracker - Local Build & Deploy
REGISTRY = gitea.chedius.ru/chedius
PLATFORM = linux/amd64
COMMIT_SHA := $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo dev)
VERSION_PART ?= patch
# Build and push both services
.PHONY: all build push deploy install-hooks
.PHONY: all build push deploy install-hooks version version-patch version-minor version-major check-release-message release
all: build push
build:
docker build --platform $(PLATFORM) -t $(REGISTRY)/delivery-tracker/backend:latest ./backend
docker build --platform $(PLATFORM) -t $(REGISTRY)/delivery-tracker/frontend:latest ./frontend
docker build --platform $(PLATFORM) --build-arg GITEA_SHA=$(COMMIT_SHA) -t $(REGISTRY)/delivery-tracker/frontend:latest ./frontend
push:
docker push $(REGISTRY)/delivery-tracker/backend:latest
@@ -36,9 +38,23 @@ install-hooks:
chmod +x .githooks/*
@echo "✅ Git hooks installed from .githooks/"
# Full release: commit, push, and auto-build via hook
release:
version:
@node -p "require('./frontend/package.json').version"
version-patch:
cd frontend && npm version patch --no-git-tag-version
version-minor:
cd frontend && npm version minor --no-git-tag-version
version-major:
cd frontend && npm version major --no-git-tag-version
check-release-message:
@if [ -z "$(MSG)" ]; then echo "Usage: make release MSG='commit message'"; exit 1; fi
# Full release: commit, push, and auto-build via hook
release: check-release-message version-$(VERSION_PART)
git add -A
git commit -m "$(MSG)" || true
git push