FROM node:22-bookworm-slim
# Chromium (website screenshots) + Python 3 with requests (the read-only chain tools). No ML deps: the build stays light.
RUN apt-get update && apt-get install -y --no-install-recommends chromium python3 python3-requests fonts-liberation fonts-noto-color-emoji ca-certificates tzdata wget \
  && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --no-audit --no-fund
COPY . .
RUN mkdir -p /app/data && python3 chain/keccak.py
ENV NODE_ENV=production PORT=3000 CHROMIUM_PATH=/usr/bin/chromium PYTHON=python3 TZ=UTC
EXPOSE 3000
# a container that cannot boot is never swapped in (2026-10-08 rule)
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=4 CMD wget -qO- http://127.0.0.1:3000/health >/dev/null || exit 1
CMD ["node","server.js"]
