This commit is contained in:
NotII
2025-04-06 16:00:44 +01:00
parent 7d76e41bc4
commit be2455dda0
2 changed files with 36 additions and 7 deletions

View File

@@ -31,6 +31,28 @@ export async function getGitCommitInfo(): Promise<GitInfo> {
return gitInfo;
}
// In Docker, the hash might be stored in a file at /app/git_commit_sha
if (typeof window === 'undefined') {
try {
const fs = require('fs');
const path = require('path');
// Check for Docker-specific git hash file
const dockerGitHashPath = '/app/git_commit_sha';
if (fs.existsSync(dockerGitHashPath)) {
const hash = fs.readFileSync(dockerGitHashPath, 'utf8').trim();
const gitInfo: GitInfo = {
commitHash: hash,
buildTime: new Date().toISOString(),
};
cachedGitInfo = gitInfo;
return gitInfo;
}
} catch (error) {
console.warn('Could not read git hash from Docker file', error);
}
}
// In the browser, fetch from the public directory
if (typeof window !== 'undefined') {
try {