docker: install for linux
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -131,14 +131,31 @@ export class Install {
|
||||
}
|
||||
|
||||
private async installLinux(toolDir: string): Promise<void> {
|
||||
core.addPath(toolDir);
|
||||
core.info('Added Docker to PATH');
|
||||
const dockerHost = `unix://${path.join(Context.tmpDir(), 'docker.sock')}`;
|
||||
|
||||
await core.group('Install Docker daemon', async () => {
|
||||
const bashPath: string = await io.which('bash', true);
|
||||
await Exec.exec('sudo', ['-E', bashPath, scripts.setupDockerLinux], {
|
||||
env: Object.assign({}, process.env, {
|
||||
TOOLDIR: toolDir,
|
||||
RUNDIR: Context.tmpDir(),
|
||||
DOCKER_HOST: dockerHost
|
||||
}) as {
|
||||
[key: string]: string;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await core.group('Create Docker context', async () => {
|
||||
await Exec.exec('docker', ['context', 'create', 'setup-docker-action', '--docker', `host=${dockerHost}`]);
|
||||
await Exec.exec('docker', ['context', 'use', 'setup-docker-action']);
|
||||
});
|
||||
}
|
||||
|
||||
private async installWindows(toolDir: string): Promise<void> {
|
||||
const dockerHost = 'npipe:////./pipe/setup_docker_action';
|
||||
|
||||
const setupCmd = await Util.powershellCommand(scripts.setupDockerPowershell, {
|
||||
const setupCmd = await Util.powershellCommand(scripts.setupDockerWin, {
|
||||
ToolDir: toolDir,
|
||||
TmpDir: Context.tmpDir(),
|
||||
DockerHost: dockerHost
|
||||
|
||||
@@ -18,5 +18,6 @@ import path from 'path';
|
||||
|
||||
const scriptsPath = path.join(__dirname, '..', 'scripts');
|
||||
|
||||
export const setupDockerPowershell = path.join(scriptsPath, 'setup-docker.ps1');
|
||||
export const setupDockerLinux = path.join(scriptsPath, 'setup-docker-linux.sh');
|
||||
export const setupDockerWin = path.join(scriptsPath, 'setup-docker-win.ps1');
|
||||
export const colimaConfig = path.join(scriptsPath, 'colima.yaml');
|
||||
|
||||
Reference in New Issue
Block a user