Add build arguments for Docker image and update Makefile

- Introduced VERSION, BUILD_DATE, and VCS_REF variables to the Makefile for enhanced Docker image metadata.
- Added a new docker-build target to facilitate building the Docker image with the specified metadata, improving version tracking and documentation.
This commit is contained in:
2025-12-27 11:34:11 -06:00
parent c9c74c778e
commit aa55beab4a

View File

@@ -1,8 +1,11 @@
.PHONY: all build-frontend build-go clean release run lint scan check format test dev
.PHONY: all build-frontend build-go clean release run lint scan check format test dev docker-build
BINARY_NAME=software-station
FRONTEND_DIR=frontend
BUILD_DIR=build
VERSION=$(shell grep '"version":' $(FRONTEND_DIR)/package.json | cut -d'"' -f4)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
VCS_REF=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
all: build-frontend build-go
@@ -44,3 +47,11 @@ clean:
rm -rf $(FRONTEND_DIR)/build
rm -f $(BINARY_NAME)
rm -f coverage.out
docker-build:
docker build \
--build-arg VERSION=$(VERSION) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg VCS_REF=$(VCS_REF) \
-t $(BINARY_NAME):latest \
-t $(BINARY_NAME):$(VERSION) .