Move server back to index.js

This commit is contained in:
wancat committed 2023-07-15 15:43:13 +08:00
1 parent de637f3cf6
commit 45a0aa6249
5 files changed
+38 -38

No files matched your search

+4 -2
View File
@@ -16,7 +16,9 @@ const containerOptions = {
export async function getOrCreateContainer(name) {
try {
const container = engine.getContainer(name)
await container.inspect()
if (!(await container.inspect()).State.Running) {
await container.start()
}
return container
} catch (error) {
const container = await engine.createContainer({
@@ -29,7 +31,7 @@ export async function getOrCreateContainer(name) {
}
}
export async function attachContainer(container) {
export function attachContainer(container) {
// Create an exec instance with bash shell
return container.attach({
stream: true,