2023-01-17 11:53:57 +01:00
|
|
|
import * as exec from '@actions/exec';
|
|
|
|
|
|
2023-01-23 10:07:14 +01:00
|
|
|
export class Docker {
|
|
|
|
|
public static async isAvailable(): Promise<boolean> {
|
|
|
|
|
return await exec
|
|
|
|
|
.getExecOutput('docker', undefined, {
|
|
|
|
|
ignoreReturnCode: true,
|
|
|
|
|
silent: true
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return res.exitCode == 0;
|
|
|
|
|
})
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
.catch(error => {
|
2023-01-17 11:53:57 +01:00
|
|
|
return false;
|
2023-01-23 10:07:14 +01:00
|
|
|
});
|
|
|
|
|
}
|
2023-01-17 11:53:57 +01:00
|
|
|
}
|