Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dockerfile for Savvi-AI Next.js application
|
| 2 |
+
|
| 3 |
+
# 1. Base Image
|
| 4 |
+
# Use an official Node.js runtime as a parent image.
|
| 5 |
+
# Using 'slim' for a smaller image size.
|
| 6 |
+
FROM node:20-slim
|
| 7 |
+
|
| 8 |
+
# 2. Set Working Directory
|
| 9 |
+
# Create and set the working directory inside the container.
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# 3. Install Dependencies
|
| 13 |
+
# Copy package.json and install dependencies.
|
| 14 |
+
# This is done in a separate step to leverage Docker's layer caching.
|
| 15 |
+
# The layer will only be rebuilt if package.json changes.
|
| 16 |
+
COPY package.json ./
|
| 17 |
+
RUN npm install
|
| 18 |
+
|
| 19 |
+
# 4. Copy Application Code
|
| 20 |
+
# Copy the rest of your app's source code from your host to your image filesystem.
|
| 21 |
+
COPY . .
|
| 22 |
+
|
| 23 |
+
# 5. Build the Application
|
| 24 |
+
# Build the Next.js app for production.
|
| 25 |
+
RUN npm run build
|
| 26 |
+
|
| 27 |
+
# 6. Expose Port
|
| 28 |
+
# The Next.js app runs on port 3000 by default.
|
| 29 |
+
EXPOSE 3000
|
| 30 |
+
|
| 31 |
+
# 7. Start the Application
|
| 32 |
+
# Define the command to run the app.
|
| 33 |
+
# The `start` script is defined in package.json as "next start".
|
| 34 |
+
# We pass -p 3000 to be explicit about the port.
|
| 35 |
+
CMD ["npm", "start", "--", "-p", "3000"]
|