Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|