fix: expose build info in Docker image for /health endpoint - #1
Open
CodedTricks wants to merge 1 commit into
Open
fix: expose build info in Docker image for /health endpoint#1CodedTricks wants to merge 1 commit into
CodedTricks wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
/healthendpoint returnsversion,commit, andbuild_timefields sourced fromstate.build_info. These are populated at compile time viaoption_env!("LUMENQRAPH_GIT_SHA")andoption_env!("LUMENQRAPH_BUILD_TIME")inmain.rs. The Dockerfile never set those environment variables during thecargo buildstep, so every Docker-based deployment returned empty strings for all three fields.What was implemented
ARG GIT_COMMITandARG BUILD_TIMEto the builder stage, forwarded asENV LUMENQRAPH_GIT_SHAandENV LUMENQRAPH_BUILD_TIMEbeforecargo build --release --workspaceso theoption_env!()macros resolve to real valuesbuild: .tobuild.context + build.argsfor all three service containers (indexer,api,webhooks); added header comment with exampleexportcommands for local usebuild-argsto thedocker/build-push-actionstep, passingGIT_COMMIT=${{ github.sha }}andBUILD_TIME=${{ github.event.repository.updated_at }}build-argson the CI smoke-test buildTesting
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 theunknownfallback.Closes Lumen-Scribe#257