docker: fix volume path to use with public
This commit is contained in:
parent
297d94d419
commit
4cc6767c78
2 changed files with 12 additions and 3 deletions
|
|
@ -38,5 +38,5 @@ RUN npm i -g pnpm@9.0.4
|
|||
RUN npm init -yp
|
||||
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
|
||||
EXPOSE 8080
|
||||
VOLUME /app/dist
|
||||
VOLUME /app/public
|
||||
ENTRYPOINT ["node", "server.js", "--prod"]
|
||||
|
|
|
|||
13
server.js
13
server.js
|
|
@ -30,8 +30,12 @@ app.get('/config.json', (req, res, next) => {
|
|||
config = require('./config.json')
|
||||
} catch {
|
||||
try {
|
||||
config = require('./dist/config.json')
|
||||
} catch { }
|
||||
config = require('./public/config.json')
|
||||
} catch {
|
||||
try {
|
||||
config = require('./dist/config.json')
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
res.json({
|
||||
...config,
|
||||
|
|
@ -45,6 +49,11 @@ if (isProd) {
|
|||
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
|
||||
next()
|
||||
})
|
||||
|
||||
// First serve from the override directory (volume mount)
|
||||
app.use(express.static(path.join(__dirname, './public')))
|
||||
|
||||
// Then fallback to the original dist directory
|
||||
app.use(express.static(path.join(__dirname, './dist')))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue