Tantawi65 commited on
Commit
e07d173
·
1 Parent(s): 17c508c

Fix client path resolution for Docker

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -0
  2. server/src/index.ts +4 -1
Dockerfile CHANGED
@@ -24,6 +24,7 @@ USER node
24
 
25
  # Hugging Face Spaces uses port 7860, Render/Railway use PORT env
26
  ENV PORT=7860
 
27
  EXPOSE 7860
28
 
29
  # Start server (path changed due to rootDir: "..")
 
24
 
25
  # Hugging Face Spaces uses port 7860, Render/Railway use PORT env
26
  ENV PORT=7860
27
+ ENV NODE_ENV=production
28
  EXPOSE 7860
29
 
30
  # Start server (path changed due to rootDir: "..")
server/src/index.ts CHANGED
@@ -15,7 +15,10 @@ const app = express();
15
  app.use(cors());
16
 
17
  // Serve static files from client build in production
18
- const clientPath = path.join(__dirname, '../../client/dist');
 
 
 
19
  app.use(express.static(clientPath));
20
 
21
  const httpServer = createServer(app);
 
15
  app.use(cors());
16
 
17
  // Serve static files from client build in production
18
+ // Use process.cwd() for Docker (cwd is /app), fallback to relative path for local dev
19
+ const clientPath = process.env.NODE_ENV === 'production'
20
+ ? path.join(process.cwd(), 'client/dist')
21
+ : path.join(__dirname, '../../client/dist');
22
  app.use(express.static(clientPath));
23
 
24
  const httpServer = createServer(app);