mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: remove hard coded project path
+ pass host_pwd using docker compose + mount it only when provided
This commit is contained in:
1 parent
cf5b761f3f
commit
4b3a80608c
4 files changed
+10
-9
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { Server } from 'socket.io'
|
||||
import { getOrCreateContainer, attachContainer } from '../utils/docker.js'
|
||||
import { getOrCreateContainer, attachContainer } from '../containers/docker.js'
|
||||
import Session from '../models/session.js'
|
||||
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
||||
|
||||
|
||||
@@ -7,4 +7,5 @@ export default {
|
||||
jwtSecret: get('JWT_SECRET', 'secret'),
|
||||
dockerNetwork: get('DOCKER_NETWORK', 'linux-odyssey-players'),
|
||||
isProduction: process.env.NODE_ENV === 'production',
|
||||
hostPwd: get('HOST_PWD', ''),
|
||||
}
|
||||
@@ -3,8 +3,6 @@ import config from '../config.js'
|
||||
|
||||
const engine = new Docker()
|
||||
|
||||
const projectPath = '/home/zeko/src/linux-odyssey'
|
||||
|
||||
const containerOptions = {
|
||||
Image: 'lancatlin/linux-odyssey:helloworld',
|
||||
AttachStdin: true,
|
||||
@@ -14,12 +12,13 @@ const containerOptions = {
|
||||
OpenStdin: true,
|
||||
StdinOnce: false,
|
||||
HostConfig: {
|
||||
Binds: config.isProduction
|
||||
? []
|
||||
: [
|
||||
`${projectPath}/quests/helloworld/home:/home/rudeus`,
|
||||
`${projectPath}/packages/container:/usr/local/lib/container`,
|
||||
],
|
||||
Binds:
|
||||
config.isProduction && config.hostPwd
|
||||
? []
|
||||
: [
|
||||
`${config.hostPwd}/quests/helloworld/home:/home/rudeus`,
|
||||
`${config.hostPwd}/packages/container:/usr/local/lib/container`,
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user