FROM node:20-alpine AS base

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm ci

# Copy source
COPY . .

# Build
RUN npm run build

EXPOSE 3000

FROM base AS dev
CMD ["npm", "run", "dev"]

FROM base AS prod
CMD ["npm", "start"]