# Dockerfile for Savvi-AI Next.js application # 1. Base Image # Use an official Node.js runtime as a parent image. # Using 'slim' for a smaller image size. FROM node:20-slim # 2. Set Working Directory # Create and set the working directory inside the container. WORKDIR /app # 3. Install Dependencies # Copy package.json and install dependencies. # This is done in a separate step to leverage Docker's layer caching. # The layer will only be rebuilt if package.json changes. COPY package.json ./ RUN npm install # 4. Copy Application Code # Copy the rest of your app's source code from your host to your image filesystem. COPY . . # 5. Build the Application # Build the Next.js app for production. RUN npm run build # 6. Expose Port # The Next.js app runs on port 3000 by default. EXPOSE 3000 # 7. Start the Application # Define the command to run the app. # The `start` script is defined in package.json as "next start". # We pass -p 3000 to be explicit about the port. CMD ["npm", "start", "--", "-p", "3000"]