fix: update quest image name

This commit is contained in:
wancat committed 2023-11-18 22:25:05 +08:00
1 parent aed66a4fe5
commit f9e0fade3b
8 files changed
+25 -15

No files matched your search

+1 -1
View File
@@ -31,6 +31,6 @@ jobs:
build-base: build-base:
uses: ./.github/workflows/build-docker-image.yml uses: ./.github/workflows/build-docker-image.yml
with: with:
imageName: 'linuxodyssey/base' imageName: 'linuxodyssey/quest-base'
dockerfilePath: './quests/Dockerfile' dockerfilePath: './quests/Dockerfile'
secrets: inherit secrets: inherit
+1 -1
View File
@@ -77,7 +77,7 @@ services:
- BUG_REPORT_URL=${BUG_REPORT_URL} - BUG_REPORT_URL=${BUG_REPORT_URL}
base: base:
image: linuxodyssey/base image: linuxodyssey/quest-base
build: build:
context: . context: .
dockerfile: ./quests/Dockerfile dockerfile: ./quests/Dockerfile
+3 -3
View File
@@ -16,7 +16,7 @@ services:
- app-test - app-test
app-test: app-test:
image: lancatlin/linux-odyssey:app image: linuxodyssey/app
build: build:
context: . context: .
dockerfile: app/Dockerfile dockerfile: app/Dockerfile
@@ -29,7 +29,7 @@ services:
- backend - backend
backend: backend:
image: lancatlin/linux-odyssey:backend image: linuxodyssey/backend
build: build:
context: . context: .
dockerfile: server/Dockerfile dockerfile: server/Dockerfile
@@ -73,7 +73,7 @@ services:
- 27017:27017 - 27017:27017
base: base:
image: lancatlin/linux-odyssey:base image: linuxodyssey/quest-base
build: build:
context: . context: .
dockerfile: ./quests/Dockerfile dockerfile: ./quests/Dockerfile
+4 -1
View File
@@ -14,6 +14,7 @@ services:
volumes: volumes:
- ./app:/app/app - ./app:/app/app
- ./packages:/app/packages - ./packages:/app/packages
backend: backend:
depends_on: depends_on:
- db - db
@@ -62,6 +63,8 @@ services:
- '3001:3001' - '3001:3001'
environment: environment:
- MONGO_URL=mongodb://db:27017/odyssey-test - MONGO_URL=mongodb://db:27017/odyssey-test
- USERNAME=user
- PASSWORD=user
volumes: volumes:
- ./packages/analytics:/app/packages/analytics - ./packages/analytics:/app/packages/analytics
- ./packages/models:/app/packages/models - ./packages/models:/app/packages/models
@@ -85,7 +88,7 @@ services:
- SWAGGER_FILE=/tmp/swagger.yaml - SWAGGER_FILE=/tmp/swagger.yaml
base: base:
image: lancatlin/linux-odyssey:base image: linuxodyssey/quest-base
build: build:
context: . context: .
dockerfile: ./quests/Dockerfile dockerfile: ./quests/Dockerfile
+1 -1
View File
@@ -1,3 +1,3 @@
FROM lancatlin/linux-odyssey:base FROM linuxodyssey/quest-base
COPY home ${HOME} COPY home ${HOME}
+1 -1
View File
@@ -1,3 +1,3 @@
FROM lancatlin/linux-odyssey:base FROM linuxodyssey/quest-base
COPY home ${HOME} COPY home ${HOME}
+9 -2
View File
@@ -24,7 +24,6 @@ const config = {
port: get('PORT', 3000), port: get('PORT', 3000),
db: get('MONGO_URL', 'mongodb://localhost:27017/odyssey-test'), db: get('MONGO_URL', 'mongodb://localhost:27017/odyssey-test'),
secret: get('SECRET_KEY', ''), secret: get('SECRET_KEY', ''),
dockerNetwork: get('DOCKER_NETWORK', 'linux-odyssey-players'),
isProduction: process.env.NODE_ENV === 'production', isProduction: process.env.NODE_ENV === 'production',
hostPwd: get('HOST_PWD', ''), hostPwd: get('HOST_PWD', ''),
containerExpiry: get('EXPIRY', 1000 * 60 * 60), containerExpiry: get('EXPIRY', 1000 * 60 * 60),
@@ -40,9 +39,13 @@ const config = {
trustedProxies: getTrustProxies('TRUSTED_PROXIES'), trustedProxies: getTrustProxies('TRUSTED_PROXIES'),
surveyUrl: getUrl('SURVEY_URL', ''), surveyUrl: getUrl('SURVEY_URL', ''),
bugReportUrl: getUrl('BUG_REPORT_URL', ''), bugReportUrl: getUrl('BUG_REPORT_URL', ''),
dockerImage: get('DOCKER_IMAGE', 'lancatlin/linux-odyssey'),
docker: {
network: get('DOCKER_NETWORK', 'linux-odyssey-players'),
defaultImage: get('QUEST_IMAGE', 'linuxodyssey/quest-base'),
imagePrefix: get('DOCKER_PREFIX', 'linuxodyssey/quest-'),
mountQuest: get('MOUNT_QUEST', ''), mountQuest: get('MOUNT_QUEST', ''),
},
} }
config.baseUrl = get('BASE_URL', `http://${config.host}:${config.port}`) config.baseUrl = get('BASE_URL', `http://${config.host}:${config.port}`)
@@ -52,4 +55,8 @@ config.testing = {
password: get('TESTING_PASSWORD', ''), password: get('TESTING_PASSWORD', ''),
} }
export function getQuestImage(id) {
return `${config.docker.imagePrefix}${id}`
}
export default config export default config
+5 -5
View File
@@ -1,5 +1,5 @@
import Docker from 'dockerode' import Docker from 'dockerode'
import config from '../config.js' import config, { getQuestImage } from '../config.js'
const engine = new Docker() const engine = new Docker()
@@ -11,17 +11,17 @@ const containerOptions = {
OpenStdin: true, OpenStdin: true,
StdinOnce: false, StdinOnce: false,
HostConfig: { HostConfig: {
NetworkMode: config.dockerNetwork, NetworkMode: config.docker.network,
}, },
} }
// const network = engine.getNetwork(config.dockerNetwork) // const network = engine.getNetwork(config.dockerNetwork)
export function createContainer(name, tag) { export function createContainer(name, questId) {
const option = { const option = {
...containerOptions, ...containerOptions,
name, name,
Image: `${config.dockerImage}:${tag}`, Image: getQuestImage(questId),
} }
if (!config.isProduction && config.hostPwd && config.mountQuest) { if (!config.isProduction && config.hostPwd && config.mountQuest) {
option.HostConfig.Bind = [ option.HostConfig.Bind = [
@@ -87,7 +87,7 @@ export function buildQuestImage(questPath, questId) {
src: ['Dockerfile', 'home'], src: ['Dockerfile', 'home'],
}, },
{ {
t: `${config.dockerImage}:${questId}`, t: getQuestImage(questId),
networkmode: 'none', networkmode: 'none',
memory: 10 * 1e6, memory: 10 * 1e6,
}, },