Skip to content

Add live version to web interface from git tags via Makefile - #61

Merged
maxi07 merged 3 commits into
mainfrom
copilot/add-live-version-display
Jun 30, 2026
Merged

maxi07 merged 3 commits into
mainfrom
copilot/add-live-version-display

Conversation

Copilot AI commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Replace hard-coded version string with dynamic version derived from git describe --tags --always --dirty, passed through the Docker build pipeline as an environment variable.

Makefile

  • New Makefile with start, stop, build, restart, clean, test targets
  • Resolves version via git describe and exports as APP_VERSION

Docker build pipeline

  • docker-compose.yml / docker-compose.test.yml: pass APP_VERSION as build arg to all services (default: dev)
  • All service Dockerfiles: accept ARG APP_VERSION=dev, set ENV APP_VERSION

Web service

  • inject_config() reads os.environ.get("APP_VERSION") with fallback to config.json
  • Logs version at boot

Usage:

make start        # builds and runs with version from git tag
make build        # build only
APP_VERSION=v1.2.3 make start  # manual override

- Create Makefile that reads git tag version via `git describe`
- Pass APP_VERSION as Docker build arg through docker-compose.yml
- Update all Dockerfiles to accept APP_VERSION build arg and set as env var
- Read APP_VERSION env var in web service instead of hard-coded config value
- Log app version at web service boot
- Fall back to config.json version if env var not set

Agent-Logs-Url: https://github.com/maxi07/ScanSync/sessions/1ae7444f-19ab-4386-b174-a6292ff5885d

Co-authored-by: maxi07 <7480270+maxi07@users.noreply.github.com>
Copilot AI changed the title [WIP] Add live version to web interface instead of hard coding Add live version to web interface from git tags via Makefile May 24, 2026
Copilot finished work on behalf of maxi07 May 24, 2026 10:05
Copilot AI requested a review from maxi07 May 24, 2026 10:05
@maxi07
maxi07 requested a review from Copilot June 30, 2026 09:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the web UI’s hard-coded version with a dynamic version derived from git describe, propagated through Docker build args into container environment variables, and surfaced via the Flask template context.

Changes:

  • Add a repository Makefile intended to compute/export APP_VERSION from git describe and provide common docker compose targets.
  • Pass APP_VERSION as a Docker build arg in docker-compose.yml / docker-compose.test.yml and set it as an image env var via ARG/ENV in multiple service Dockerfiles.
  • Update the web service to log and inject APP_VERSION (with a config fallback) into templates.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
web_service/src/main.py Logs and injects APP_VERSION into the Flask template context for display in the UI.
web_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
upload_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
ocr_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
metadata_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
file_naming_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
detection_service/Dockerfile Accepts APP_VERSION as a build arg and sets it as an image env var.
docker-compose.yml Wires APP_VERSION through build args for most built services.
docker-compose.test.yml Wires APP_VERSION through build args for the web-service test build.
Makefile Adds git describe-based version resolution and common lifecycle/test targets.

Comment thread Makefile Outdated
Comment thread Makefile
Comment on lines +32 to +35
start:
@echo "Starting ScanSync (Version: $(GIT_VERSION))..."
APP_VERSION=$(GIT_VERSION) $(DOCKER_COMPOSE) up --build -d

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Removed the inline APP_VERSION=$(GIT_VERSION) override from the start recipe — the exported $(APP_VERSION) variable is now passed implicitly.

Comment thread Makefile
Comment on lines +47 to +51
.PHONY: build
build:
@echo "Building ScanSync (Version: $(GIT_VERSION))..."
APP_VERSION=$(GIT_VERSION) $(DOCKER_COMPOSE) build

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Same as start — removed the inline APP_VERSION=$(GIT_VERSION) from the build recipe so the exported variable is used consistently.

Comment thread web_service/src/main.py Outdated
Comment thread web_service/src/main.py
Comment on lines 169 to 172
return dict(
failed_document_count=failed_document_count,
version=config.get("version", "Unknown"),
version=os.environ.get("APP_VERSION", config.get("version", "Unknown")),
onedrive_token_error=is_token_expired(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed to os.environ.get("APP_VERSION") or config.get("version", "Unknown") so an empty-string APP_VERSION correctly falls back to the config value.

Comment thread docker-compose.yml
Comment on lines 18 to 22
context: .
dockerfile: ocr_service/Dockerfile
args:
- APP_VERSION=${APP_VERSION:-dev}
restart: unless-stopped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Converted smb_service to the long build syntax with APP_VERSION=${APP_VERSION:-dev} build arg, and added ARG APP_VERSION=dev / ENV APP_VERSION=${APP_VERSION} to its Dockerfile.

Comment thread docker-compose.test.yml
Comment on lines 3 to +7
build:
context: .
dockerfile: web_service/Dockerfile
args:
- APP_VERSION=${APP_VERSION:-dev}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Added APP_VERSION=${APP_VERSION:-dev} build arg to test_service in docker-compose.test.yml and the corresponding ARG/ENV instructions to test_service/Dockerfile.

@maxi07 maxi07 linked an issue Jun 30, 2026 that may be closed by this pull request
@maxi07
maxi07 marked this pull request as ready for review June 30, 2026 10:13
@maxi07
maxi07 merged commit cf472eb into main Jun 30, 2026
3 checks passed
@maxi07
maxi07 deleted the copilot/add-live-version-display branch June 30, 2026 10:22
maxi07 added a commit that referenced this pull request Jul 1, 2026
* Initial plan

* Add dynamic version from git tags via Makefile and Docker build args

- Create Makefile that reads git tag version via `git describe`
- Pass APP_VERSION as Docker build arg through docker-compose.yml
- Update all Dockerfiles to accept APP_VERSION build arg and set as env var
- Read APP_VERSION env var in web service instead of hard-coded config value
- Log app version at web service boot
- Fall back to config.json version if env var not set

Agent-Logs-Url: https://github.com/maxi07/ScanSync/sessions/1ae7444f-19ab-4386-b174-a6292ff5885d



* Fix review comments: APP_VERSION override, fallback logic, smb/test service build args

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: maxi07 <7480270+maxi07@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add live version to web interface instead of hard coding Add Makefile for easier control of containers

3 participants