diff --git a/Dockerfile b/Dockerfile index cd30151..17673fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ COPY . . # Standalone-Output aktiviert kleinste Images ENV NEXT_TELEMETRY_DISABLED=1 +ARG BUILD_DATE +ENV NEXT_PUBLIC_BUILD_DATE=$BUILD_DATE RUN npm run build # ── Stage 3: Produktions-Image ──────────────────────────────────────────────── diff --git a/components/AppLayout.tsx b/components/AppLayout.tsx index 032cfd9..8d74a16 100644 --- a/components/AppLayout.tsx +++ b/components/AppLayout.tsx @@ -1,5 +1,6 @@ 'use client'; +import { useEffect, useState } from 'react'; import LogoutButton from '@/components/LogoutButton'; import packageJson from '@/package.json'; @@ -9,7 +10,13 @@ interface AppLayoutProps { export default function AppLayout({ children }: AppLayoutProps) { const version = packageJson.version; - const buildDate = process.env.NEXT_PUBLIC_BUILD_DATE || new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' }); + const [buildDate, setBuildDate] = useState(process.env.NEXT_PUBLIC_BUILD_DATE || ''); + + useEffect(() => { + if (!buildDate) { + setBuildDate(new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })); + } + }, []); return (