'/.dockerenv' did not exist in container...

This commit is contained in:
Ralf Vogler 2023-08-28 01:25:09 +02:00
parent 6560afa2b5
commit 9261be690c

View file

@ -1,7 +1,7 @@
// check if running the latest version // check if running the latest version
import {log} from 'console'; import {log} from 'console';
import { existsSync, readFileSync } from 'fs'; import { readFileSync } from 'fs';
import { exec } from 'child_process'; import { exec } from 'child_process';
const execp = (cmd) => new Promise((resolve, reject) => { const execp = (cmd) => new Promise((resolve, reject) => {
@ -22,7 +22,8 @@ const execp = (cmd) => new Promise((resolve, reject) => {
const git_main = () => readFileSync('.git/refs/heads/main').toString().trim(); const git_main = () => readFileSync('.git/refs/heads/main').toString().trim();
let sha, date; let sha, date;
if (existsSync('/.dockerenv')) { // if (existsSync('/.dockerenv')) { // did not work
if (process.env.NOVNC_PORT) {
log('Running inside Docker.'); log('Running inside Docker.');
['COMMIT', 'BRANCH', 'NOW'].forEach(v => log(` ${v}:`, process.env[v])); ['COMMIT', 'BRANCH', 'NOW'].forEach(v => log(` ${v}:`, process.env[v]));
sha = process.env.COMMIT; sha = process.env.COMMIT;