initial commit
This commit is contained in:
5
node_modules/is-docker/cli.js
generated
vendored
Executable file
5
node_modules/is-docker/cli.js
generated
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
import process from 'node:process';
|
||||
import isDocker from './index.js';
|
||||
|
||||
process.exitCode = isDocker() ? 0 : 2;
|
13
node_modules/is-docker/index.d.ts
generated
vendored
Normal file
13
node_modules/is-docker/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
Check if the process is running inside a Docker container.
|
||||
|
||||
@example
|
||||
```
|
||||
import isDocker from 'is-docker';
|
||||
|
||||
if (isDocker()) {
|
||||
console.log('Running inside a Docker container');
|
||||
}
|
||||
```
|
||||
*/
|
||||
export default function isDocker(): boolean;
|
29
node_modules/is-docker/index.js
generated
vendored
Normal file
29
node_modules/is-docker/index.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
9
node_modules/is-docker/license
generated
vendored
Normal file
9
node_modules/is-docker/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
44
node_modules/is-docker/package.json
generated
vendored
Normal file
44
node_modules/is-docker/package.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "is-docker",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if the process is running inside a Docker container",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-docker",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"bin": "./cli.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"cli.js"
|
||||
],
|
||||
"keywords": [
|
||||
"detect",
|
||||
"docker",
|
||||
"dockerized",
|
||||
"container",
|
||||
"inside",
|
||||
"is",
|
||||
"env",
|
||||
"environment",
|
||||
"process"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"sinon": "^11.1.2",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
27
node_modules/is-docker/readme.md
generated
vendored
Normal file
27
node_modules/is-docker/readme.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# is-docker
|
||||
|
||||
> Check if the process is running inside a Docker container
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-docker
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isDocker from 'is-docker';
|
||||
|
||||
if (isDocker()) {
|
||||
console.log('Running inside a Docker container');
|
||||
}
|
||||
```
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ is-docker
|
||||
```
|
||||
|
||||
Exits with code 0 if inside a Docker container and 2 if not.
|
Reference in New Issue
Block a user