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 ( + + ); +}