Skip to content

Commit 416560b

Browse files
committed
feat(build): output container information
1 parent e0fd26a commit 416560b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/api/docker.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,23 @@ export function createContainer(
3737
'5900/tcp': [{ HostPort: '' }]
3838
}
3939
} as any)
40+
.then(container => {
41+
const msg = style.bold.open + style.yellow.open + '==> ' + style.yellow.close +
42+
`starting container ` + style.yellow.open + name + ' ' + style.yellow.close +
43+
`from image ` + style.yellow.open + image + ' ' + style.yellow.close +
44+
`... ` + style.bold.close;
45+
observer.next({ type: 'data', data: msg });
46+
return container;
47+
})
4048
.then(container => container.start())
4149
.then(container => container.inspect())
4250
.then(info => observer.next({ type: 'containerInfo', data: info }))
51+
.then(() => {
52+
observer.next({ type: 'data', data: 'done.\r\n' });
53+
})
4354
.then(() => observer.complete())
4455
.catch(err => {
56+
observer.next({ type: 'data', data: 'error.\r\n' });
4557
observer.next({ type: 'containerError', data: err });
4658
observer.error(err);
4759
});
@@ -184,7 +196,7 @@ export function killContainer(id: string): Promise<void> {
184196
if (containerInfo.State.Status === 'exited') {
185197
return container.remove();
186198
} else if (containerInfo.State.Status === 'running') {
187-
return container.kill().then(() => container.remove());
199+
return container.kill();
188200
} else {
189201
return Promise.resolve();
190202
}

0 commit comments

Comments
 (0)