mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: auto create config folder and player network
This commit is contained in:
1 parent
91ebaec22c
commit
b449d84c54
5 files changed
+25
-2
No files matched your search
@@ -47,9 +47,22 @@ export async function createContainer(
|
||||
]
|
||||
}
|
||||
const option = newContainerOptions(name, imageId, { binds })
|
||||
await createNetworkIfNotExists(config.docker.network)
|
||||
return engine.createContainer(option)
|
||||
}
|
||||
|
||||
async function createNetworkIfNotExists(network: string) {
|
||||
const dockerNetworks = await engine.listNetworks({
|
||||
filters: {
|
||||
name: [network],
|
||||
},
|
||||
})
|
||||
if (dockerNetworks.length === 0) {
|
||||
console.log('Creating player network', network)
|
||||
await engine.createNetwork({ Name: network })
|
||||
}
|
||||
}
|
||||
|
||||
async function questHomeExists(imageId: string) {
|
||||
try {
|
||||
const stat = await fs.stat(`${config.projectRoot}/quests/${imageId}/home`)
|
||||
|
||||
Reference in new issue
Block a user