Browse Source

fix(agent): include chat UI HTML in production build

Copy agent-chat.html to dist output in Dockerfile.railway and add
fallback path lookup in controller for production deployments.
pull/6459/head
jpwilson 1 month ago
parent
commit
2af4c9f835
  1. 3
      Dockerfile.railway
  2. 5
      apps/api/src/app/agent/agent.controller.ts

3
Dockerfile.railway

@ -39,6 +39,9 @@ COPY prisma /ghostfolio/dist/apps/api/prisma/
COPY package.json /ghostfolio/dist/apps/api/ COPY package.json /ghostfolio/dist/apps/api/
RUN npm run database:generate-typings RUN npm run database:generate-typings
# Copy agent chat HTML to dist
RUN cp /ghostfolio/apps/api/src/app/agent/agent-chat.html /ghostfolio/dist/apps/api/ 2>/dev/null || true
# Runtime image # Runtime image
FROM node:22-slim FROM node:22-slim
ENV NODE_ENV=production ENV NODE_ENV=production

5
apps/api/src/app/agent/agent.controller.ts

@ -40,7 +40,7 @@ export class AgentController {
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
// Try source path first (dev), then dist path // Try source path first (dev), then dist paths
const paths = [ const paths = [
path.join( path.join(
process.cwd(), process.cwd(),
@ -51,7 +51,8 @@ export class AgentController {
'agent', 'agent',
'agent-chat.html' 'agent-chat.html'
), ),
path.join(__dirname, 'agent-chat.html') path.join(__dirname, 'agent-chat.html'),
path.join(process.cwd(), 'agent-chat.html')
]; ];
for (const p of paths) { for (const p of paths) {

Loading…
Cancel
Save