Skip to content

Commit 164f565

Browse files
prashantgupta24njhill
authored andcommitted
✨ Log image commit hash during startup
Signed-off-by: Prashant Gupta <[email protected]>
1 parent f27b7bc commit 164f565

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,13 @@ RUN cargo install --path .
121121
## Launcher builder ############################################################
122122
FROM rust-builder as launcher-builder
123123

124+
ARG GIT_COMMIT_HASH
124125
COPY launcher launcher
125126

126127
WORKDIR /usr/src/launcher
127128

128129
#RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/usr/src/launcher/target cargo install --path .
129-
RUN cargo install --path .
130+
RUN env GIT_COMMIT_HASH=${GIT_COMMIT_HASH} cargo install --path .
130131

131132
## Tests base ##################################################################
132133
FROM base as test-base

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
SHELL := /bin/bash
22

3+
GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
4+
35
build:
4-
DOCKER_BUILDKIT=1 docker build --progress=plain --target=server-release -t text-gen-server:0 .
6+
DOCKER_BUILDKIT=1 docker build --progress=plain --target=server-release --build-arg GIT_COMMIT_HASH=$(GIT_COMMIT_HASH) -t text-gen-server:0 .
57
docker images
68

79
all: help
@@ -16,7 +18,7 @@ install-router:
1618
cd router && cargo install --path .
1719

1820
install-launcher:
19-
cd launcher && cargo install --path .
21+
cd launcher && env GIT_COMMIT_HASH=$(GIT_COMMIT_HASH) cargo install --path .
2022

2123
install: install-server install-router install-launcher install-custom-kernels
2224

launcher/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ fn main() -> ExitCode {
105105
} else {
106106
tracing_subscriber::fmt().compact().init();
107107
}
108+
// log TGIS commit hash
109+
if let Some(commit_hash) = option_env!("GIT_COMMIT_HASH") {
110+
info!("TGIS Commit hash: {commit_hash}");
111+
}
108112

109113
info!("Launcher args: {:?}", args);
110114
if args.cuda_process_memory_fraction <= 0.0 || args.cuda_process_memory_fraction > 1.0 {

0 commit comments

Comments
 (0)