feat: add templates/games support with subpath routing and Docker build integration
This commit is contained in:
@@ -12,6 +12,13 @@ RUN bun install
|
||||
COPY mobile/ .
|
||||
RUN bun run build:web
|
||||
|
||||
FROM oven/bun:1.2.18 AS games-builder
|
||||
WORKDIR /games
|
||||
COPY games/package.json ./
|
||||
RUN bun install
|
||||
COPY games/ .
|
||||
RUN bun run build
|
||||
|
||||
FROM oven/bun:1.2.18
|
||||
WORKDIR /app
|
||||
COPY backend/package.json backend/bun.lock backend/tsconfig.json ./
|
||||
@@ -19,6 +26,7 @@ RUN bun install --frozen-lockfile --production
|
||||
COPY backend/src ./src
|
||||
COPY --from=website-builder /website/dist ./public
|
||||
COPY --from=mobile-builder /mobile/dist ./public/mobile
|
||||
COPY --from=games-builder /games/dist ./public/games
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=8080
|
||||
|
||||
@@ -64,6 +64,13 @@ app.get('/{*path}', (req, res, next) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.path.startsWith('/games')) {
|
||||
res.sendFile(path.join(publicDir, 'games/index.html'), (err) => {
|
||||
if (err) next();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
res.sendFile(path.join(publicDir, 'index.html'), (err) => {
|
||||
if (err) next();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user