# ALZAR FZE Website — production image
FROM node:20-slim AS base
RUN npm install -g pnpm@10.4.1
WORKDIR /app

# Install deps (cached layer)
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --no-frozen-lockfile

# Build
COPY . .
RUN pnpm build

# Postgres client (for running schema.sql) + runtime
RUN apt-get update && apt-get install -y postgresql-client && rm -rf /var/lib/apt/lists/*

ENV NODE_ENV=production
EXPOSE 3000
CMD ["pnpm", "start"]
