Files
zeekay 9934d6ef8d Restore full dynamic lux.network (un-strip static export)
The live site had been stripped to a static export (output:'export') to fit
GitHub Pages, which forced removal of every dynamic feature: the @luxfi/ui
Header/Footer chrome rendered as plain 'LUX' text, the @hanzo/commerce checkout,
the lux.id auth API routes + middleware, and leaked gold/amber accents.

Restore the full app on top of the post-quantum landing content:
- Dynamic output:'standalone' Node server (next.config.mjs); drop static export.
- Real @luxfi/ui Header/Footer with the canonical @luxfi/logo ▼ mark
  (logoVariant='full'); mega-menus + full footer.
- @hanzo/commerce /checkout + commerce bag, login routed to lux.id, restored
  src/app/api/auth/* routes and src/middleware.ts (device + auth).
- Pure monochrome: neutralize all rainbow/gold chain + app gradients to
  from-foreground/[0.06]; kill the gold 'Bridge Assets' button.
- site-def: re-enable auth (login->lux.id) + commerce (both stripped before).

Fixes uncovered along the way:
- patch @hanzo/[email protected]: invalid 'type App' in a runtime await-import destructure
  broke the auth API route compile.
- next.config SVGR loader: @luxfi/ui's footer imports an inline .svg as a
  component; without the loader it resolves to an object -> hydration crash
  (black page). This was the real root cause behind a cascade of symptoms.
- ShowBody MutationObserver: @luxfi/ui RootLayout ships <body display:none> and
  reveals it from an effect that loses a hydration race on standalone; pin it.
- src/middleware: react-device-detect throws on UA-less requests (k8s probes,
  curl) -> 500; default to 'desktop' and add a static-asset matcher.

Build, real-browser verify (e2e/restore-verify.mjs + rewritten homepage.spec):
logo, 0 gold/amber, mega-menu, full footer, checkout host, login->lux.id, no
console crash, monochrome — 8/8 green. Dockerfile = standalone Node runner.
2026-06-25 14:40:53 -07:00

52 lines
2.1 KiB
Docker

# lux.network — full dynamic Next.js app served by a Node server.
#
# This is NOT a static export. The app has auth API routes (/api/auth/*),
# src/middleware.ts (device + auth), an SSR @luxfi/ui Header/Footer chrome, and
# the @hanzo/commerce crypto-native /checkout — none of which can run under
# `output: 'export'`. next.config.mjs uses `output: 'standalone'`, so we bake
# the standalone Node server (.next/standalone/server.js) + static assets into a
# slim node:alpine runtime. Built by luxfi/lux-network self-hosted CI (the
# `lux-build` ARC runner on evo — never GitHub builders), published to
# ghcr.io/luxfi/lux-network:<semver>, pinned in luxfi/universe, served behind
# hanzoai/ingress on DOKS, fronted by Cloudflare. See LLM.md.
# --- build stage ---
FROM node:22.14.0-alpine AS build
RUN apk add --no-cache libc6-compat python3 make g++ git
RUN corepack enable && corepack prepare [email protected] --activate
WORKDIR /app
# Cacheable dependency layer (lockfile + patches drive resolution).
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY patches ./patches
RUN pnpm install --frozen-lockfile
# Build the standalone server. NEXT_PUBLIC_LOGIN_SITE_URL must be set at build
# time — @hanzo/auth's AuthWidget bakes the lux.id login URL into the bundle.
ARG NEXT_PUBLIC_LOGIN_SITE_URL=https://lux.id/login
ENV NEXT_PUBLIC_LOGIN_SITE_URL=${NEXT_PUBLIC_LOGIN_SITE_URL}
COPY . .
ENV NODE_OPTIONS="--max-old-space-size=8192"
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm build && test -f .next/standalone/server.js
# --- runtime stage ---
FROM node:22.14.0-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
RUN addgroup -g 1001 -S nodejs && adduser -u 1001 -S nextjs -G nodejs
# The standalone output bundles only the server's runtime deps. Static assets
# and /public are NOT included in standalone and must be copied alongside.
COPY --from=build --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=build --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=build --chown=nextjs:nodejs /app/public ./public
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]