KingNish commited on
Commit
3472fa7
·
verified ·
1 Parent(s): f57f4c3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -11
Dockerfile CHANGED
@@ -1,24 +1,31 @@
1
- # 1. Base image with Node.js
2
  FROM node:18-alpine
3
 
4
- # 2. Set working directory inside the container
 
 
 
5
  WORKDIR /app
6
 
7
- # 3. Copy package files and install dependencies
8
- COPY package.json package-lock.json* ./
9
- RUN npm install
10
 
11
- # 4. Copy all other source files
12
  COPY . .
13
 
14
- # 5. Build the Next.js app
 
 
 
 
15
  RUN npm run build
16
 
17
- # 6. Set environment variable for the custom port
18
  ENV PORT=7860
19
-
20
- # 7. Expose port 7860
21
  EXPOSE 7860
22
 
23
- # 8. Start the Next.js app
 
 
24
  CMD ["npm", "start"]
 
1
+ # 1. Use official Node.js 18 (Alpine) image
2
  FROM node:18-alpine
3
 
4
+ # 2. Disable Next.js telemetry
5
+ ENV NEXT_TELEMETRY_DISABLED=1
6
+
7
+ # 3. Set working directory
8
  WORKDIR /app
9
 
10
+ # 4. Copy package manifest and install all dependencies (including dev)
11
+ COPY package.json package-lock.json ./
12
+ RUN npm ci
13
 
14
+ # 5. Copy source
15
  COPY . .
16
 
17
+ # 6. Turn off ESLint during build
18
+ # (so lint errors won't block the build)
19
+ RUN printf "module.exports = { eslint: { ignoreDuringBuilds: true } };\n" > next.config.ts
20
+
21
+ # 7. Build your Next.js app
22
  RUN npm run build
23
 
24
+ # 8. Expose your custom port
25
  ENV PORT=7860
 
 
26
  EXPOSE 7860
27
 
28
+ # 9. Launch in production mode on port 7860
29
+ # Assumes you've added in package.json:
30
+ # "scripts": { "start": "next start -p 7860" }
31
  CMD ["npm", "start"]