| # Use the official Node.js 18 image as base | |
| FROM node:18.17.0-alpine as builder | |
| # Set working directory inside the container | |
| WORKDIR /app | |
| # Copy package.json and package-lock.json to install dependencies | |
| COPY package.json . | |
| COPY package-lock.json . | |
| # Install dependencies | |
| RUN npm install | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Build the Next.js project | |
| RUN npm run build | |
| # Expose port 3000 | |
| EXPOSE 3000 | |
| # Start the Next.js application | |
| CMD ["npm", "start"] | |