mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
fix: restore server changes
This commit is contained in:
1 parent
ef279ba00e
commit
b64f49915f
1 file changed
+8
-6
@@ -3,6 +3,7 @@ import config, { getQuestImage } from '../config.js'
|
|||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
const engine = new Docker()
|
const engine = new Docker()
|
||||||
|
|
||||||
const containerOptions = {
|
const containerOptions = {
|
||||||
AttachStdin: true,
|
AttachStdin: true,
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
@@ -15,9 +16,10 @@ const containerOptions = {
|
|||||||
},
|
},
|
||||||
} as Docker.ContainerCreateOptions
|
} as Docker.ContainerCreateOptions
|
||||||
|
|
||||||
// const network = engine.getNetwork(config.dockerNetwork)
|
export function createContainer(
|
||||||
|
name: string,
|
||||||
export function createContainer(name: any, questId: any) {
|
questId: string
|
||||||
|
): Promise<Docker.Container> {
|
||||||
const option = {
|
const option = {
|
||||||
...containerOptions,
|
...containerOptions,
|
||||||
name,
|
name,
|
||||||
@@ -27,8 +29,8 @@ export function createContainer(name: any, questId: any) {
|
|||||||
if (!config.isProduction && hostPwd && mountQuest === questId) {
|
if (!config.isProduction && hostPwd && mountQuest === questId) {
|
||||||
logger.info('Mounting quest folder', mountQuest)
|
logger.info('Mounting quest folder', mountQuest)
|
||||||
option.HostConfig!.Binds = [
|
option.HostConfig!.Binds = [
|
||||||
`${hostPwd.replace(/\\/g, '/')}/quests/${mountQuest}/home:/home/commander`,
|
`${hostPwd}/quests/${mountQuest}/home:/home/commander`,
|
||||||
`${hostPwd.replace(/\\/g, '/')}/packages/container:/usr/local/lib/container`,
|
`${hostPwd}/packages/container:/usr/local/lib/container`,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
return engine.createContainer(option)
|
return engine.createContainer(option)
|
||||||
@@ -60,7 +62,7 @@ export async function attachContainer(
|
|||||||
Tty: true,
|
Tty: true,
|
||||||
Env: [
|
Env: [
|
||||||
`TOKEN=${token}`,
|
`TOKEN=${token}`,
|
||||||
`API_ENDPOINT=http://backend:3000`,
|
`API_ENDPOINT=${config.backendUrl}`,
|
||||||
'ZDOTDIR=/etc/zsh',
|
'ZDOTDIR=/etc/zsh',
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user