From 9ea4906406f75c4f600f4a4daa98b0f05f8ec9c2 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Tue, 31 Mar 2026 13:01:55 +0000 Subject: [PATCH] fix: serve frontend static files and build in docker --- Dockerfile | 3 +++ src/server/app.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index 9fda9d0..9478c9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,9 @@ RUN npm install COPY . . +# Build the frontend +RUN npm run build + EXPOSE 3000 CMD ["npm", "run", "start"] diff --git a/src/server/app.ts b/src/server/app.ts index f858bf5..e7a1847 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -40,6 +40,14 @@ if (!fs.existsSync(uploadsPath)) { app.use('/uploads', express.static(uploadsPath)); +// Serve frontend static files +const distPath = path.join(process.cwd(), 'dist'); +app.use(express.static(distPath)); + +app.get('*', (req, res) => { + res.sendFile(path.join(distPath, 'index.html')); +}); + // Routes app.use('/api/users', userRoutes); app.use('/api/projects', projectRoutes);