# Use an official Node runtime as a parent image FROM node:24.11 RUN corepack enable # Set the working directory in the container WORKDIR /usr/src/app # Copy your manifest files first for better caching COPY package.json yarn.lock ./ # Install ALL dependencies (including devDependencies) RUN yarn install --production=false # Copy the rest of your project COPY . . # Build the Next.js app RUN yarn build # Install PM2 globally RUN npm install pm2 -g # App listens on port 3000 EXPOSE 3000 # Run Next using PM2 CMD ["pm2-runtime", "start", "npm", "--", "start"]