mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
convert analytics to TS
This commit is contained in:
1 parent
9509bbc355
commit
ece0ec7c41
25 files changed
+11595
-661
No files matched your search
@@ -2,7 +2,7 @@ import Docker from 'dockerode'
|
||||
import config, { getQuestImage } from '../config.js'
|
||||
import logger from '../utils/logger.js'
|
||||
|
||||
const engine = new Docker()
|
||||
const engine = new Docker({ socketPath: '//./pipe/docker_engine' })
|
||||
|
||||
const containerOptions = {
|
||||
AttachStdin: true,
|
||||
@@ -16,6 +16,8 @@ const containerOptions = {
|
||||
},
|
||||
}
|
||||
|
||||
// const network = engine.getNetwork(config.dockerNetwork)
|
||||
|
||||
export function createContainer(name, questId) {
|
||||
const option = {
|
||||
...containerOptions,
|
||||
@@ -26,8 +28,8 @@ export function createContainer(name, questId) {
|
||||
if (!config.isProduction && hostPwd && mountQuest === questId) {
|
||||
logger.info('Mounting quest folder', mountQuest)
|
||||
option.HostConfig.Binds = [
|
||||
`${hostPwd}/quests/${mountQuest}/home:/home/commander`,
|
||||
`${hostPwd}/packages/container:/usr/local/lib/container`,
|
||||
`${hostPwd.replace(/\\/g, '/')}/quests/${mountQuest}/home:/home/commander`,
|
||||
`${hostPwd.replace(/\\/g, '/')}/packages/container:/usr/local/lib/container`,
|
||||
]
|
||||
}
|
||||
return engine.createContainer(option)
|
||||
@@ -54,7 +56,7 @@ export async function attachContainer(container, { token }) {
|
||||
Tty: true,
|
||||
Env: [
|
||||
`TOKEN=${token}`,
|
||||
`API_ENDPOINT=${config.backendUrl}`,
|
||||
`API_ENDPOINT=http://backend:3000`,
|
||||
'ZDOTDIR=/etc/zsh',
|
||||
],
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user