diff --git a/Dockerfile.web b/Dockerfile.web index d574ea9..e26dfa5 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -13,7 +13,8 @@ RUN apk add --no-cache git wget \ && corepack enable \ && corepack prepare pnpm@9.15.9 --activate -RUN git clone --depth 1 --branch "${C0PY_REF}" "${C0PY_REPO}" /app +RUN git clone --depth 1 --branch "${C0PY_REF}" "${C0PY_REPO}" /app \ + && git -C /app rev-parse HEAD > /app/.c0py-commit WORKDIR /app @@ -28,6 +29,6 @@ ENV NEXT_TELEMETRY_DISABLED=1 EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD wget -qO- http://127.0.0.1:3000/ >/dev/null 2>&1 || exit 1 + CMD wget -qO- http://127.0.0.1:3000/api/health >/dev/null 2>&1 || exit 1 CMD ["pnpm", "--filter", "@siax/c0py-web", "start"] diff --git a/apps/web/src/app/api/health/route.ts b/apps/web/src/app/api/health/route.ts new file mode 100644 index 0000000..b3a6f3c --- /dev/null +++ b/apps/web/src/app/api/health/route.ts @@ -0,0 +1,29 @@ +import { readFileSync } from "node:fs"; +import { apiBaseUrl } from "../../../lib/api-status"; + +/** Build commit, written by Dockerfile.web into .c0py-commit at image build time. */ +function commit(): string { + const fromEnv = process.env.C0PY_WEB_COMMIT?.trim(); + if (fromEnv) return fromEnv; + for (const path of [".c0py-commit", "/app/.c0py-commit"]) { + try { + const value = readFileSync(path, "utf8").trim(); + if (value) return value; + } catch { + /* not present in this environment */ + } + } + return "unknown"; +} + +export const dynamic = "force-dynamic"; + +export function GET() { + return Response.json({ + status: "ok", + service: "c0py-web", + commit: commit(), + apiBaseUrl: apiBaseUrl(), + time: new Date().toISOString(), + }); +} diff --git a/apps/web/src/app/icon.svg b/apps/web/src/app/icon.svg new file mode 100644 index 0000000..871dd47 --- /dev/null +++ b/apps/web/src/app/icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 167de53..9f14b75 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -1,3 +1,44 @@ +import type { Metadata } from "next"; + +export const metadata: Metadata = { + title: "C0PY — evidence-driven capture console", + description: + "C0PY is the canonical SIAX engine for evidence-driven web product capture, digital-twin specification, reconstruction and verification.", +}; + +const globalCss = ` + :root { + --c0py-ink: #15151b; + --c0py-accent: #5326cc; + --c0py-paper: #ffffff; + --c0py-muted: #5b5b66; + --c0py-line: #e4e4ec; + --c0py-band: #15151b; + --c0py-ok: #1b7f4f; + --c0py-warn: #96591a; + } + * { box-sizing: border-box; } + html, body { margin: 0; padding: 0; } + body { + background: var(--c0py-paper); + color: var(--c0py-ink); + font-family: Inter, "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; + font-size: 16px; + line-height: 1.55; + -webkit-font-smoothing: antialiased; + } + h1, h2, h3 { color: var(--c0py-ink); margin: 0; font-weight: 650; letter-spacing: -0.01em; } + a { color: var(--c0py-accent); } + code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; } +`; + export default function RootLayout({ children }: { children: React.ReactNode }) { - return {children}; + return ( + + +