Skip to content

fix: expose build info in Docker image for /health endpoint - #1

Open
CodedTricks wants to merge 1 commit into
mainfrom
fix/257-dockerfile-build-info
Open

fix: expose build info in Docker image for /health endpoint#1
CodedTricks wants to merge 1 commit into
mainfrom
fix/257-dockerfile-build-info

Conversation

@CodedTricks

Copy link
Copy Markdown
Owner

Summary

The /health endpoint returns version, commit, and build_time fields sourced from state.build_info. These are populated at compile time via option_env!("LUMENQRAPH_GIT_SHA") and option_env!("LUMENQRAPH_BUILD_TIME") in main.rs. The Dockerfile never set those environment variables during the cargo build step, so every Docker-based deployment returned empty strings for all three fields.

What was implemented

  • Dockerfile: added ARG GIT_COMMIT and ARG BUILD_TIME to the builder stage, forwarded as ENV LUMENQRAPH_GIT_SHA and ENV LUMENQRAPH_BUILD_TIME before cargo build --release --workspace so the option_env!() macros resolve to real values
  • docker-compose.full.yml: expanded build: . to build.context + build.args for all three service containers (indexer, api, webhooks); added header comment with example export commands for local use
  • .github/workflows/docker-publish.yml: added build-args to the docker/build-push-action step, passing GIT_COMMIT=${{ github.sha }} and BUILD_TIME=${{ github.event.repository.updated_at }}
  • .github/workflows/docker.yml: same build-args on the CI smoke-test build

Testing

The binary is compiled at CI time with option_env!() macros; the /health endpoint now reads real values from the baked-in constants instead of the unknown fallback.

Closes Lumen-Scribe#257

…ribe#257)

Add ARG GIT_COMMIT and ARG BUILD_TIME to the Dockerfile builder stage,
forwarded as ENV LUMENQRAPH_GIT_SHA and LUMENQRAPH_BUILD_TIME so that
the option_env!() macros in main.rs pick them up at compile time.

Without these build args the /health endpoint always returns empty
strings for version commit and build_time regardless of which image
is deployed making it impossible to identify the running binary.

Changes:
- Dockerfile: add ARG GIT_COMMIT / ARG BUILD_TIME before cargo build,
  set ENV LUMENQRAPH_GIT_SHA / LUMENQRAPH_BUILD_TIME from the ARGs
- docker-compose.full.yml: expand build: . to build.context + build.args
  for all three service containers; document GIT_COMMIT/BUILD_TIME in
  the header comment with example export commands
- .github/workflows/docker-publish.yml: pass build-args with
  github.sha and repository updated_at on both PR and tag builds
- .github/workflows/docker.yml: pass the same build-args on the CI
  smoke-test build so the check image also carries real metadata

Closes Lumen-Scribe#257
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.

The API build_info fields (version, commit, build_time) are always empty strings because no build-time variables are set in the Dockerfile

1 participant