From 875d17b62f9af2a43a76bc4ae8a490798ff9d5b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matth=C3=A4us=20Mayer?=
<7984982+theMattCode@users.noreply.github.com>
Date: Wed, 17 Jun 2026 09:12:16 +0200
Subject: [PATCH 01/10] Run cockpit prod with srvx
---
apps/cockpit/Dockerfile | 2 +-
apps/cockpit/package.json | 1 +
pnpm-lock.yaml | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/apps/cockpit/Dockerfile b/apps/cockpit/Dockerfile
index 3dabe27..0947173 100644
--- a/apps/cockpit/Dockerfile
+++ b/apps/cockpit/Dockerfile
@@ -35,4 +35,4 @@ RUN pnpm --dir apps/cockpit run build
WORKDIR /workspace/apps/cockpit
EXPOSE 3000
-CMD ["pnpm", "exec", "vite", "preview", "--host", "0.0.0.0", "--port", "3000", "--strictPort"]
+CMD ["pnpm", "exec", "srvx", "serve", "--dir", ".", "--entry", "dist/server/server.js", "--static", "dist/client", "--prod"]
diff --git a/apps/cockpit/package.json b/apps/cockpit/package.json
index bc639d4..56dfc03 100644
--- a/apps/cockpit/package.json
+++ b/apps/cockpit/package.json
@@ -32,6 +32,7 @@
"react": "19.2.4",
"react-dom": "19.2.4",
"react-icons": "5.5.0",
+ "srvx": "0.11.8",
"tailwindcss": "4.3.0"
},
"devDependencies": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8a10db5..5f85e89 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -74,6 +74,9 @@ importers:
react-icons:
specifier: 5.5.0
version: 5.5.0(react@19.2.4)
+ srvx:
+ specifier: 0.11.8
+ version: 0.11.8
tailwindcss:
specifier: 4.3.0
version: 4.3.0
From 27fcf3001bcb7cd34cecafe8015618e914411338 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matth=C3=A4us=20Mayer?=
<7984982+theMattCode@users.noreply.github.com>
Date: Wed, 17 Jun 2026 09:18:55 +0200
Subject: [PATCH 02/10] Install only prod deps in cockpit image
---
apps/cockpit/Dockerfile | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/apps/cockpit/Dockerfile b/apps/cockpit/Dockerfile
index 0947173..6592d05 100644
--- a/apps/cockpit/Dockerfile
+++ b/apps/cockpit/Dockerfile
@@ -28,11 +28,47 @@ WORKDIR /workspace/apps/cockpit
EXPOSE 3000
CMD ["pnpm", "exec", "vite", "dev", "--host", "0.0.0.0", "--port", "3000", "--strictPort"]
-FROM base AS prod
+FROM base AS build
COPY . .
RUN pnpm --dir apps/cockpit run build
+FROM node:24-alpine AS prod-deps
+ENV PNPM_HOME='/pnpm'
+ENV PATH="$PNPM_HOME:$PATH"
+
+RUN corepack enable
+
+WORKDIR /workspace
+
+COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
+COPY apps/cockpit/package.json apps/cockpit/package.json
+COPY libs/ts-log/package.json libs/ts-log/package.json
+
+RUN pnpm install --prod --frozen-lockfile --ignore-scripts
+
+FROM node:24-alpine AS prod
+ENV PNPM_HOME='/pnpm'
+ENV PATH="$PNPM_HOME:$PATH"
+
+ARG BACKEND_BASE_URL=http://localhost:5010
+ARG ASSISTANT_SERVICE_BASE_URL=http://localhost:5020
+ARG VITE_BACKEND_API_BASE_URL=http://localhost:5010
+ARG VITE_ASSISTANT_API_BASE_URL=http://localhost:5020
+ENV BACKEND_BASE_URL=$BACKEND_BASE_URL
+ENV VITE_BACKEND_API_BASE_URL=$VITE_BACKEND_API_BASE_URL
+ENV ASSISTANT_SERVICE_BASE_URL=$ASSISTANT_SERVICE_BASE_URL
+ENV VITE_ASSISTANT_API_BASE_URL=$VITE_ASSISTANT_API_BASE_URL
+
+RUN corepack enable
+
+WORKDIR /workspace
+
+COPY --from=prod-deps /workspace/node_modules ./node_modules
+COPY --from=prod-deps /workspace/apps/cockpit/node_modules ./apps/cockpit/node_modules
+COPY . .
+COPY --from=build /workspace/apps/cockpit/dist apps/cockpit/dist
+
WORKDIR /workspace/apps/cockpit
EXPOSE 3000
CMD ["pnpm", "exec", "srvx", "serve", "--dir", ".", "--entry", "dist/server/server.js", "--static", "dist/client", "--prod"]
From a4669ff2f0c458a2f4403cbe9c363d2e4972c3ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matth=C3=A4us=20Mayer?=
<7984982+theMattCode@users.noreply.github.com>
Date: Wed, 17 Jun 2026 09:23:08 +0200
Subject: [PATCH 03/10] Copy only cockpit runtime artifacts
---
apps/cockpit/Dockerfile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/apps/cockpit/Dockerfile b/apps/cockpit/Dockerfile
index 6592d05..c9a067b 100644
--- a/apps/cockpit/Dockerfile
+++ b/apps/cockpit/Dockerfile
@@ -66,7 +66,9 @@ WORKDIR /workspace
COPY --from=prod-deps /workspace/node_modules ./node_modules
COPY --from=prod-deps /workspace/apps/cockpit/node_modules ./apps/cockpit/node_modules
-COPY . .
+COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
+COPY apps/cockpit/package.json apps/cockpit/package.json
+COPY libs/ts-log/package.json libs/ts-log/package.json
COPY --from=build /workspace/apps/cockpit/dist apps/cockpit/dist
WORKDIR /workspace/apps/cockpit
From bb552bb6cc138d8724530f77e244083d4775c108 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matth=C3=A4us=20Mayer?=
<7984982+theMattCode@users.noreply.github.com>
Date: Wed, 17 Jun 2026 10:02:30 +0200
Subject: [PATCH 04/10] Deploy cockpit runtime with pnpm deploy
---
apps/cockpit/Dockerfile | 36 +++++++-----------------------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/apps/cockpit/Dockerfile b/apps/cockpit/Dockerfile
index c9a067b..90dc8de 100644
--- a/apps/cockpit/Dockerfile
+++ b/apps/cockpit/Dockerfile
@@ -31,26 +31,10 @@ CMD ["pnpm", "exec", "vite", "dev", "--host", "0.0.0.0", "--port", "3000", "--st
FROM base AS build
COPY . .
-RUN pnpm --dir apps/cockpit run build
-
-FROM node:24-alpine AS prod-deps
-ENV PNPM_HOME='/pnpm'
-ENV PATH="$PNPM_HOME:$PATH"
-
-RUN corepack enable
-
-WORKDIR /workspace
-
-COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
-COPY apps/cockpit/package.json apps/cockpit/package.json
-COPY libs/ts-log/package.json libs/ts-log/package.json
-
-RUN pnpm install --prod --frozen-lockfile --ignore-scripts
+RUN pnpm --dir apps/cockpit run build \
+ && pnpm --filter @central/cockpit deploy --prod --legacy --offline /workspace/cockpit-deploy
FROM node:24-alpine AS prod
-ENV PNPM_HOME='/pnpm'
-ENV PATH="$PNPM_HOME:$PATH"
-
ARG BACKEND_BASE_URL=http://localhost:5010
ARG ASSISTANT_SERVICE_BASE_URL=http://localhost:5020
ARG VITE_BACKEND_API_BASE_URL=http://localhost:5010
@@ -60,17 +44,11 @@ ENV VITE_BACKEND_API_BASE_URL=$VITE_BACKEND_API_BASE_URL
ENV ASSISTANT_SERVICE_BASE_URL=$ASSISTANT_SERVICE_BASE_URL
ENV VITE_ASSISTANT_API_BASE_URL=$VITE_ASSISTANT_API_BASE_URL
-RUN corepack enable
-
-WORKDIR /workspace
+WORKDIR /workspace/apps/cockpit
-COPY --from=prod-deps /workspace/node_modules ./node_modules
-COPY --from=prod-deps /workspace/apps/cockpit/node_modules ./apps/cockpit/node_modules
-COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
-COPY apps/cockpit/package.json apps/cockpit/package.json
-COPY libs/ts-log/package.json libs/ts-log/package.json
-COPY --from=build /workspace/apps/cockpit/dist apps/cockpit/dist
+COPY --from=build /workspace/cockpit-deploy/node_modules ./node_modules
+COPY --from=build /workspace/cockpit-deploy/package.json ./package.json
+COPY --from=build /workspace/apps/cockpit/dist ./dist
-WORKDIR /workspace/apps/cockpit
EXPOSE 3000
-CMD ["pnpm", "exec", "srvx", "serve", "--dir", ".", "--entry", "dist/server/server.js", "--static", "dist/client", "--prod"]
+CMD ["node", "node_modules/srvx/bin/srvx.mjs", "serve", "--dir", ".", "--entry", "dist/server/server.js", "--static", "dist/client", "--prod"]
From 00a1507c6e1c36f576cb70b9c93a6426dc288b7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matth=C3=A4us=20Mayer?=
<7984982+theMattCode@users.noreply.github.com>
Date: Wed, 17 Jun 2026 10:11:58 +0200
Subject: [PATCH 05/10] Keep cockpit devtools out of prod
---
apps/cockpit/package.json | 4 ++--
apps/cockpit/src/routes/__root.tsx | 8 +++++---
apps/cockpit/vite.config.ts | 2 +-
pnpm-lock.yaml | 12 ++++++------
4 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/apps/cockpit/package.json b/apps/cockpit/package.json
index 56dfc03..7b7c030 100644
--- a/apps/cockpit/package.json
+++ b/apps/cockpit/package.json
@@ -23,9 +23,7 @@
"@meteocons/svg": "^0.1.0",
"@ricky0123/vad-react": "0.0.33",
"@tailwindcss/vite": "4.2.1",
- "@tanstack/react-devtools": "0.9.6",
"@tanstack/react-router": "1.163.2",
- "@tanstack/react-router-devtools": "1.163.2",
"@tanstack/react-router-ssr-query": "1.163.2",
"@tanstack/react-start": "1.163.2",
"@tanstack/router-plugin": "1.163.2",
@@ -37,6 +35,8 @@
},
"devDependencies": {
"@tanstack/devtools-vite": "0.5.1",
+ "@tanstack/react-devtools": "0.9.6",
+ "@tanstack/react-router-devtools": "1.163.2",
"@testing-library/dom": "10.4.1",
"@testing-library/react": "16.3.2",
"@testing-library/user-event": "14.6.1",
diff --git a/apps/cockpit/src/routes/__root.tsx b/apps/cockpit/src/routes/__root.tsx
index b4e49f0..4b4b266 100644
--- a/apps/cockpit/src/routes/__root.tsx
+++ b/apps/cockpit/src/routes/__root.tsx
@@ -1,13 +1,15 @@
-import type { PropsWithChildren } from 'react';
+import { lazy, type PropsWithChildren } from 'react';
import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router';
import appCss from '../styles.css?url';
import { PageLayout } from '@/components/PageLayout/PageLayout.tsx';
-import { Devtools } from '@/components/Devtools/Devtools.tsx';
import { Section } from '@/components/Section/Section.tsx';
import { ContentLayout } from '@/components/ContentLayout/ContentLayout.tsx';
import { Navigation } from '@/components/Navigation/Navigation.tsx';
import { MdOutlineHome as HomeIcon } from 'react-icons/md';
+const Devtools = import.meta.env.DEV
+ ? lazy(() => import('@/components/Devtools/Devtools.tsx').then((module) => ({ default: module.Devtools })))
+ : null;
const title = 'Central Dashboard';
export const Route = createRootRoute({
@@ -33,7 +35,7 @@ function RootDocument({ children }: PropsWithChildren) {
{children}
-
+ {Devtools ? : null}