# Use Node.js as the base image
FROM node:22-alpine

# Set working directory
WORKDIR /app

# Copy package.json and yarn.lock
COPY package.json yarn.lock ./

# Install NestJS CLI globally
RUN npm install -g @nestjs/cli

# Install dependencies using Yarn (without installing it globally)
RUN yarn install --frozen-lockfile

# Copy the rest of the application files
COPY . .

# Expose the application port
EXPOSE 3000

# Start the application
CMD ["yarn", "start"]
