docker: return docker sock path on install
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -111,7 +111,7 @@ export class Install {
|
|||||||
return tooldir;
|
return tooldir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async install(): Promise<void> {
|
public async install(): Promise<string> {
|
||||||
if (!this.toolDir) {
|
if (!this.toolDir) {
|
||||||
throw new Error('toolDir must be set. Run download first.');
|
throw new Error('toolDir must be set. Run download first.');
|
||||||
}
|
}
|
||||||
@@ -120,16 +120,13 @@ export class Install {
|
|||||||
}
|
}
|
||||||
switch (os.platform()) {
|
switch (os.platform()) {
|
||||||
case 'darwin': {
|
case 'darwin': {
|
||||||
await this.installDarwin();
|
return await this.installDarwin();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'linux': {
|
case 'linux': {
|
||||||
await this.installLinux();
|
return await this.installLinux();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'win32': {
|
case 'win32': {
|
||||||
await this.installWindows();
|
return await this.installWindows();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform: ${os.platform()}`);
|
throw new Error(`Unsupported platform: ${os.platform()}`);
|
||||||
@@ -137,7 +134,7 @@ export class Install {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async installDarwin(): Promise<void> {
|
private async installDarwin(): Promise<string> {
|
||||||
const limaDir = path.join(os.homedir(), '.lima', this.limaInstanceName);
|
const limaDir = path.join(os.homedir(), '.lima', this.limaInstanceName);
|
||||||
await io.mkdirP(limaDir);
|
await io.mkdirP(limaDir);
|
||||||
const dockerHost = `unix://${limaDir}/docker.sock`;
|
const dockerHost = `unix://${limaDir}/docker.sock`;
|
||||||
@@ -225,9 +222,11 @@ export class Install {
|
|||||||
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
||||||
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return dockerHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async installLinux(): Promise<void> {
|
private async installLinux(): Promise<string> {
|
||||||
const dockerHost = `unix://${path.join(this.runDir, 'docker.sock')}`;
|
const dockerHost = `unix://${path.join(this.runDir, 'docker.sock')}`;
|
||||||
await io.mkdirP(this.runDir);
|
await io.mkdirP(this.runDir);
|
||||||
|
|
||||||
@@ -306,9 +305,11 @@ EOF`,
|
|||||||
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
||||||
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return dockerHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async installWindows(): Promise<void> {
|
private async installWindows(): Promise<string> {
|
||||||
const dockerHost = 'npipe:////./pipe/setup_docker_action';
|
const dockerHost = 'npipe:////./pipe/setup_docker_action';
|
||||||
|
|
||||||
let daemonConfig = undefined;
|
let daemonConfig = undefined;
|
||||||
@@ -347,6 +348,8 @@ EOF`,
|
|||||||
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
await Exec.exec('docker', ['context', 'create', this.contextName, '--docker', `host=${dockerHost}`]);
|
||||||
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
await Exec.exec('docker', ['context', 'use', this.contextName]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return dockerHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async tearDown(): Promise<void> {
|
public async tearDown(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user