FROM node:22-bookworm-slim

WORKDIR /app

# registry.npmjs.org resolves to Cloudflare's IPv6-only records here, and
# Docker's default bridge network has flaky IPv6 egress — Node's Happy
# Eyeballs then hangs on IPv6 before timing out instead of falling back to
# IPv4 quickly, causing intermittent ETIMEDOUT mid-install.
ENV NODE_OPTIONS=--dns-result-order=ipv4first

COPY package.json package-lock.json* ./
RUN npm install

COPY . .
RUN npm run build

CMD ["npm", "start", "--", "--hostname", "0.0.0.0"]

