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

@@ -4,6 +4,7 @@
REGISTRY="gitea.chedius.ru/chedius"
PLATFORM="linux/amd64"
COMMIT_SHA=$(git rev-parse --short=12 HEAD 2>/dev/null || echo dev)
echo "🔨 Building Docker images..."
@@ -14,7 +15,7 @@ docker build --platform $PLATFORM -t $REGISTRY/delivery-tracker/backend:latest .
}
# Build frontend
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 || {
echo "❌ Frontend build failed"
exit 1
}

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

View File

@@ -1,12 +1,12 @@
{
"name": "delivery-tracker",
"version": "0.0.0",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "delivery-tracker",
"version": "0.0.0",
"version": "0.0.1",
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"date-fns": "^4.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "delivery-tracker",
"private": true,
"version": "0.0.0",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",