From ceca743e58da6017005c0d8f014d45616aed991f Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 30 Oct 2026 01:27:22 +0200 Subject: [PATCH] feat: show the build commit as a faint corner mark Declares ARG NEXT_PUBLIC_APP_COMMIT, supplied by Ship, and renders it as a nearly transparent, click-through stamp. Renders nothing when unset. Co-Authored-By: Claude Sonnet 5.5 --- Dockerfile | 5 +++++ app/layout.tsx | 3 ++- components/BuildStamp.tsx | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 components/BuildStamp.tsx diff --git a/Dockerfile b/Dockerfile index f85c2b2..c4c27ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,11 @@ RUN test -n "$NEXT_PUBLIC_PB_URL" \ ENV NEXT_TELEMETRY_DISABLED=1 ENV NODE_ENV=production +# The commit being built, supplied by Ship. Declared late so the layers above +# stay cached; it is empty for builds that do not pass it. +ARG NEXT_PUBLIC_APP_COMMIT +ENV NEXT_PUBLIC_APP_COMMIT=${NEXT_PUBLIC_APP_COMMIT} + # `next build --webpack` is deliberate: @ducanh2912/next-pwa is Webpack-only # and is what generates public/sw.js + public/workbox-*.js. Dropping the flag # silently ships an app with no service worker and no offline install. diff --git a/app/layout.tsx b/app/layout.tsx index 53585d0..e913a17 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,7 @@ import "./globals.css"; import type { Metadata, Viewport } from "next"; import { ThemeProvider } from "@/components/ThemeProvider"; import { SessionLifecycle } from "@/components/auth/SessionLifecycle"; +import { BuildStamp } from "@/components/BuildStamp"; export const metadata: Metadata = { title: "Mega Plant Dashboard", @@ -45,7 +46,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) /> - {children} + {children} ); diff --git a/components/BuildStamp.tsx b/components/BuildStamp.tsx new file mode 100644 index 0000000..be90fc3 --- /dev/null +++ b/components/BuildStamp.tsx @@ -0,0 +1,32 @@ +/** + * The commit this build came from, as a faint mark in the corner. + * + * `NEXT_PUBLIC_APP_COMMIT` is set by Ship (the Forgejo Desktop app) when it + * builds the image. A build made any other way has no value, so nothing is + * rendered. It never takes a click and is nearly transparent. + */ +export function BuildStamp() { + const commit = process.env.NEXT_PUBLIC_APP_COMMIT; + if (!commit) return null; + + return ( + + ); +}