2025-11-20 11:08:24 +00:00
|
|
|
# Use an official Node runtime as a parent image
|
2025-11-20 14:11:07 +00:00
|
|
|
FROM node:24.11
|
2025-11-20 11:08:24 +00:00
|
|
|
|
|
|
|
|
RUN corepack enable
|
|
|
|
|
|
|
|
|
|
# Set the working directory in the container
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
2025-11-20 15:09:44 +00:00
|
|
|
# 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
|
2025-11-20 11:08:24 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
2025-11-20 15:09:44 +00:00
|
|
|
# Build the Next.js app
|
2025-11-20 11:08:24 +00:00
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
|
|
# Install PM2 globally
|
|
|
|
|
RUN npm install pm2 -g
|
|
|
|
|
|
2025-11-20 15:09:44 +00:00
|
|
|
# App listens on port 3000
|
2025-11-20 11:08:24 +00:00
|
|
|
EXPOSE 3000
|
|
|
|
|
|
2025-11-20 15:09:44 +00:00
|
|
|
# Run Next using PM2
|
2025-11-20 11:08:24 +00:00
|
|
|
CMD ["pm2-runtime", "start", "npm", "--", "start"]
|