0a5ab058a6
- Angular 12 application with PrimeNG components - 5 existing Cypress e2e test suites - SCSS styling with BEM naming convention - i18n support (10 languages) - Leaflet map integration - Complete component hierarchy and routing structure This baseline will be used for Angular → React migration.
30 lines
509 B
JavaScript
30 lines
509 B
JavaScript
import fs from 'node:fs';
|
|
|
|
let isDockerCached;
|
|
|
|
function hasDockerEnv() {
|
|
try {
|
|
fs.statSync('/.dockerenv');
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function hasDockerCGroup() {
|
|
try {
|
|
return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export default function isDocker() {
|
|
// TODO: Use `??=` when targeting Node.js 16.
|
|
if (isDockerCached === undefined) {
|
|
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
}
|
|
|
|
return isDockerCached;
|
|
}
|