Zerotracex-Stuff commited on
Commit
b601d38
·
1 Parent(s): a5871f0

First model version

Browse files
Files changed (3) hide show
  1. Dockerfile +5 -5
  2. package.json +1 -2
  3. server.js +17 -0
Dockerfile CHANGED
@@ -1,4 +1,3 @@
1
-
2
  # Use the official Node.js image as the base image
3
  FROM node:20-slim
4
 
@@ -7,12 +6,13 @@ WORKDIR /app
7
 
8
  # Copy package.json and package-lock.json to the working directory
9
  COPY package*.json ./
 
 
10
 
11
  # Install dependencies
12
  RUN npm install
13
 
14
- # Copy the rest of the application code to the working directory
15
- COPY . .
16
 
17
  # Build the Next.js application
18
  RUN npm run build
@@ -20,5 +20,5 @@ RUN npm run build
20
  # Expose the port your app runs on. Use 7860 as per the user's requirement.
21
  EXPOSE 7860
22
 
23
- # Command to run the application
24
- CMD ["npm", "start", "--", "-p", "7860"]
 
 
1
  # Use the official Node.js image as the base image
2
  FROM node:20-slim
3
 
 
6
 
7
  # Copy package.json and package-lock.json to the working directory
8
  COPY package*.json ./
9
+ # Copy the rest of the application code to the working directory
10
+ COPY . .
11
 
12
  # Install dependencies
13
  RUN npm install
14
 
15
+
 
16
 
17
  # Build the Next.js application
18
  RUN npm run build
 
20
  # Expose the port your app runs on. Use 7860 as per the user's requirement.
21
  EXPOSE 7860
22
 
23
+ # Command to run the custom Next.js server
24
+ CMD ["node", "server.js"]
package.json CHANGED
@@ -1,4 +1,3 @@
1
-
2
  {
3
  "name": "nextn",
4
  "version": "0.1.0",
@@ -8,7 +7,7 @@
8
  "genkit:dev": "genkit start -- tsx src/ai/dev.ts",
9
  "genkit:watch": "genkit start -- tsx --watch src/ai/dev.ts",
10
  "build": "next build",
11
- "start": "next start",
12
  "lint": "next lint",
13
  "typecheck": "tsc --noEmit",
14
  "postinstall": "cp node_modules/pdfjs-dist/build/pdf.worker.min.js public/"
 
 
1
  {
2
  "name": "nextn",
3
  "version": "0.1.0",
 
7
  "genkit:dev": "genkit start -- tsx src/ai/dev.ts",
8
  "genkit:watch": "genkit start -- tsx --watch src/ai/dev.ts",
9
  "build": "next build",
10
+ "start": "NODE_ENV=production node server.js",
11
  "lint": "next lint",
12
  "typecheck": "tsc --noEmit",
13
  "postinstall": "cp node_modules/pdfjs-dist/build/pdf.worker.min.js public/"
server.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const { createServer } = require('http');
2
+ const { parse } = require('url');
3
+ const next = require('next');
4
+
5
+ const port = parseInt(process.env.PORT, 10) || 7860;
6
+ const dev = process.env.NODE_ENV !== 'production';
7
+ const app = next({ dev });
8
+ const handle = app.getRequestHandler();
9
+
10
+ app.prepare().then(() => {
11
+ createServer((req, res) => {
12
+ const parsedUrl = parse(req.url, true);
13
+ handle(req, res, parsedUrl);
14
+ }).listen(port, () => {
15
+ console.log(`🚀 App running on http://localhost:${port}`);
16
+ });
17
+ });