fraudTech commited on
Commit
03fb333
·
1 Parent(s): 950e8ca

fix build

Browse files
Files changed (4) hide show
  1. Dockerfile +27 -0
  2. README.md +1 -3
  3. package.json +4 -2
  4. server.js +17 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy package files
6
+ COPY package*.json ./
7
+
8
+ # Install all dependencies (including devDependencies for build)
9
+ RUN npm ci
10
+
11
+ # Copy application files
12
+ COPY . .
13
+
14
+ # Build the React app
15
+ RUN npm run build
16
+
17
+ # Remove devDependencies after build
18
+ RUN npm prune --production
19
+
20
+ # Expose port
21
+ EXPOSE 7860
22
+
23
+ # Set environment variable
24
+ ENV NODE_ENV=production
25
+
26
+ # Start server
27
+ CMD ["node", "server.js"]
README.md CHANGED
@@ -3,10 +3,8 @@ title: Prolog AI
3
  emoji: 🐠
4
  colorFrom: indigo
5
  colorTo: red
6
- sdk: static
7
  pinned: false
8
- app_build_command: npm run build
9
- app_file: build/index.html
10
  ---
11
 
12
  # Getting Started with Create React App
 
3
  emoji: 🐠
4
  colorFrom: indigo
5
  colorTo: red
6
+ sdk: docker
7
  pinned: false
 
 
8
  ---
9
 
10
  # Getting Started with Create React App
package.json CHANGED
@@ -15,13 +15,15 @@
15
  "remark-math": "^6.0.0",
16
  "remark-gfm": "^4.0.0",
17
  "rehype-katex": "^7.0.0",
18
- "katex": "^0.16.10"
 
19
  },
20
  "scripts": {
21
  "start": "react-scripts start",
22
  "build": "react-scripts build",
23
  "test": "react-scripts test",
24
- "eject": "react-scripts eject"
 
25
  },
26
  "eslintConfig": {
27
  "extends": [
 
15
  "remark-math": "^6.0.0",
16
  "remark-gfm": "^4.0.0",
17
  "rehype-katex": "^7.0.0",
18
+ "katex": "^0.16.10",
19
+ "express": "^4.18.2"
20
  },
21
  "scripts": {
22
  "start": "react-scripts start",
23
  "build": "react-scripts build",
24
  "test": "react-scripts test",
25
+ "eject": "react-scripts eject",
26
+ "serve": "node server.js"
27
  },
28
  "eslintConfig": {
29
  "extends": [
server.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const path = require('path');
3
+
4
+ const app = express();
5
+ const PORT = process.env.PORT || 7860;
6
+
7
+ // Serve static files from build directory
8
+ app.use(express.static(path.join(__dirname, 'build')));
9
+
10
+ // Handle client-side routing - return index.html for all routes
11
+ app.get('*', (req, res) => {
12
+ res.sendFile(path.join(__dirname, 'build', 'index.html'));
13
+ });
14
+
15
+ app.listen(PORT, '0.0.0.0', () => {
16
+ console.log(`Server running on port ${PORT}`);
17
+ });