# Use an official Node runtime as a parent image
FROM node:18

# Set the working directory in the container to /app
WORKDIR /app

# Copy package.json and package-lock.json into the working directory
COPY package.json package-lock.json ./

# Install PM2 globally and the application's dependencies
RUN npm install pm2 -g && npm install

# Copy the rest of the application's source code
COPY . .

# Your application's default port, this should match with your application's configured port
EXPOSE 3014

# Define the command to run your app using PM2
CMD ["pm2-runtime", "start", "app.js"]
