mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +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
+7
-6
No files matched your search
@@ -28,6 +28,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- MONGO_URL=mongodb://db:27017/odyssey-test
|
- MONGO_URL=mongodb://db:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
|
- HOST_PWD=${PWD}
|
||||||
db:
|
db:
|
||||||
image: mongo
|
image: mongo
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Server } from 'socket.io'
|
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 Session from '../models/session.js'
|
||||||
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
||||||
|
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ export default {
|
|||||||
jwtSecret: get('JWT_SECRET', 'secret'),
|
jwtSecret: get('JWT_SECRET', 'secret'),
|
||||||
dockerNetwork: get('DOCKER_NETWORK', 'linux-odyssey-players'),
|
dockerNetwork: get('DOCKER_NETWORK', 'linux-odyssey-players'),
|
||||||
isProduction: process.env.NODE_ENV === 'production',
|
isProduction: process.env.NODE_ENV === 'production',
|
||||||
|
hostPwd: get('HOST_PWD', ''),
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,6 @@ import config from '../config.js'
|
|||||||
|
|
||||||
const engine = new Docker()
|
const engine = new Docker()
|
||||||
|
|
||||||
const projectPath = '/home/zeko/src/linux-odyssey'
|
|
||||||
|
|
||||||
const containerOptions = {
|
const containerOptions = {
|
||||||
Image: 'lancatlin/linux-odyssey:helloworld',
|
Image: 'lancatlin/linux-odyssey:helloworld',
|
||||||
AttachStdin: true,
|
AttachStdin: true,
|
||||||
@@ -14,11 +12,12 @@ const containerOptions = {
|
|||||||
OpenStdin: true,
|
OpenStdin: true,
|
||||||
StdinOnce: false,
|
StdinOnce: false,
|
||||||
HostConfig: {
|
HostConfig: {
|
||||||
Binds: config.isProduction
|
Binds:
|
||||||
|
config.isProduction && config.hostPwd
|
||||||
? []
|
? []
|
||||||
: [
|
: [
|
||||||
`${projectPath}/quests/helloworld/home:/home/rudeus`,
|
`${config.hostPwd}/quests/helloworld/home:/home/rudeus`,
|
||||||
`${projectPath}/packages/container:/usr/local/lib/container`,
|
`${config.hostPwd}/packages/container:/usr/local/lib/container`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user