Files
dhkatzandClaude Opus 5.5 64c552330b Website: Next.js app for accounts, linking, who's online, device sign-in and the console
apps/web: Next.js 16 (App Router), Tailwind 4 and shadcn/ui, light and dark from the system. Pages render on the
server and call the API with Eden Treaty (typed by @t5de/api), forwarding the visitor's cookie; forms use server
actions; sign-up, sign-in and sign-out use Better Auth's React client. /api is rewritten to the API so its cookies
are first-party. Who's online follows the API's event stream (Next's gzip is off: it held the stream back).
Standalone output with a Dockerfile; deploys to Vercel as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 05:02:00 -07:00

38 lines
1.3 KiB
Docker

# The hub's website as a standalone Next.js server. Build from the repository root (the app uses the workspace's
# packages for the API's types):
#
# docker build -f apps/web/Dockerfile --build-arg API_URL=http://api:4101 -t t5de-hub-web .
# docker run -p 4100:4100 -e API_URL=http://api:4101 t5de-hub-web
#
# API_URL is needed at build time too: Next fixes the /api rewrite when it builds.
FROM oven/bun:1.4.4 AS bun
FROM node:26-slim AS build
COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
WORKDIR /repo
ENV NEXT_TELEMETRY_DISABLED=1
# Dependencies first, so they're cached while only source changes.
COPY package.json bun.lock ./
COPY apps/web/package.json apps/web/
COPY apps/api/package.json apps/api/
COPY packages/db/package.json packages/db/
RUN bun install --frozen-lockfile
COPY packages/db packages/db
COPY apps/api apps/api
COPY apps/web apps/web
ARG API_URL=http://api:4101
ENV API_URL=$API_URL
RUN cd apps/web && bun run build
FROM node:26-slim
WORKDIR /app
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=4100 HOSTNAME=0.0.0.0
ARG API_URL=http://api:4101
ENV API_URL=$API_URL
COPY --from=build --chown=node:node /repo/apps/web/.next/standalone ./
COPY --from=build --chown=node:node /repo/apps/web/.next/static ./apps/web/.next/static
USER node
EXPOSE 4100
CMD ["node", "apps/web/server.js"]