# Use official Node.js image as the base
FROM node:20-alpine AS builder

# Set working directory
WORKDIR /app

# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci

# Copy the rest of the app
COPY . .

# Build the Next.js app
RUN npm run build


# Set environment variables (optional)
ENV NODE_ENV=production

# Expose port
EXPOSE 5000

# Start the Next.js app
CMD ["npm", "start"]
