## relay-policy sidecar — multi-stage build
##
## Stage 1: compile TypeScript to ES modules
## Stage 2: minimal runtime image (no dev deps, no compiler)

FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json tsconfig.json ./
RUN npm install
COPY index.ts ./
RUN npx tsc

# ── runtime ──────────────────────────────────────────────────────────────────
FROM node:22-alpine AS runtime
WORKDIR /app
COPY --from=builder /app/dist/index.js ./index.js
EXPOSE 3080
CMD ["node", "index.js"]
