Fix: make Dockerfile self-contained with multi-stage build (#24277)

Co-authored-by: David Pierce <davidapierce@google.com>
This commit is contained in:
Horizon_Architect_07
2026-05-05 01:21:06 +05:30
committed by GitHub
parent 0d6bd29752
commit b6fc583b0c
3 changed files with 71 additions and 7 deletions
+12 -6
View File
@@ -42,13 +42,19 @@ if (!existsSync(generatedCoreDir)) {
}
try {
const gitHash = execSync('git rev-parse --short HEAD', {
encoding: 'utf-8',
}).trim();
if (gitHash) {
gitCommitInfo = gitHash;
// Check for GIT_COMMIT env var first (e.g. when building inside Docker
// without a .git directory available)
const envCommit = process.env.GIT_COMMIT;
if (envCommit && /^[0-9a-f]+$/i.test(envCommit)) {
gitCommitInfo = envCommit;
} else {
const gitHash = execSync('git rev-parse --short HEAD', {
encoding: 'utf-8',
}).trim();
if (gitHash) {
gitCommitInfo = gitHash;
}
}
const result = await readPackageUp();
cliVersion = result?.packageJson?.version ?? 'UNKNOWN';
} catch {