From 32f53eb27e73828946b42020aca92a91471879d8 Mon Sep 17 00:00:00 2001 From: Joe Monk Date: Fri, 5 Sep 2025 00:39:53 +0100 Subject: [PATCH] alpine sucks sometimes --- Dockerfile | 2 +- src/app/_components/docker-table.tsx | 4 ++-- src/server/api/routers/docker.ts | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ad4ad7..dc91c51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use the official Node.js image as the base image -FROM node:24-alpine +FROM node:24-trixie-slim # Set the working directory inside the container WORKDIR /usr/src/app diff --git a/src/app/_components/docker-table.tsx b/src/app/_components/docker-table.tsx index 30d0d4d..da8f579 100644 --- a/src/app/_components/docker-table.tsx +++ b/src/app/_components/docker-table.tsx @@ -9,7 +9,7 @@ function DockerRow({ }: { containerInfo: dockerRouterType["list"][number]; }) { - const { data: latest, isError, isLoading } = api.docker.latest.useQuery({ id: containerInfo.container.id }); + const { data: latest, isError, isLoading } = api.docker.latest.useQuery({ id: containerInfo.container.id }, { refetchOnMount: false, refetchOnWindowFocus: false, refetchOnReconnect: false }); const outdated = containerInfo.image.current.hash !== latest?.latest.hash; let latestFragment: JSX.Element | null = null; @@ -52,7 +52,7 @@ function DockerRow({ } export function DockerTable() { - const { data: list, isLoading: listLoading } = api.docker.list.useQuery(); + const { data: list, isLoading: listLoading } = api.docker.list.useQuery(undefined, { refetchOnMount: false, refetchOnWindowFocus: false, refetchOnReconnect: false }); return (
{!listLoading ? ( diff --git a/src/server/api/routers/docker.ts b/src/server/api/routers/docker.ts index 1ca1386..55fa5ff 100644 --- a/src/server/api/routers/docker.ts +++ b/src/server/api/routers/docker.ts @@ -14,6 +14,7 @@ export const dockerRouter = createTRPCRouter({ const container = containers.find((container) => container.Id === input.id); if (!container) { + console.error(`Container with id ${input.id} not found`); throw new TRPCError({ code: "NOT_FOUND", message: `Container with id ${input.id} not found`, @@ -27,6 +28,7 @@ export const dockerRouter = createTRPCRouter({ latest: await getLatest(imageData.name, imageData.tag), }; } catch (ex) { + console.error(ex); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: (ex as Error).message, @@ -159,9 +161,10 @@ function isSemver(tag: string): boolean { } async function getHash(image: string) { - const latestImage = await $`bin/regctl image digest ${image}`.text(); + const latestImage = await $`./bin/regctl image digest ${image}`.text(); const hash = latestImage.split(":")?.[1]?.substring(0, 12); if (!hash) { + console.error(`Hash not found: ${latestImage}`); throw new Error("Hash not found", { cause: { imageDigest: latestImage, @@ -189,8 +192,8 @@ async function getLatest(image: string, tag?: string): Promise<{ hash: string; t } async function getSemverTag(image: string): Promise<{ hash: string; tag?: string }> { - const allTags = await $`bin/regctl tag ls --exclude 'version.*' --exclude 'unstable.*' --exclude '.*rc.*' --exclude 'lib.*' --exclude 'release.*' --exclude 'arm.* -' --exclude 'amd.*' ${image}`.text(); + const allTags = + await $`./bin/regctl tag ls --exclude 'version.*' --exclude 'unstable.*' --exclude '.*rc.*' --exclude 'lib.*' --exclude 'release.*' --exclude 'arm.*' --exclude 'amd.*' ${image}`.text(); const semverTags = allTags.split("\n").filter((tag) => isSemver(tag)); const newestTag = semver.rsort(semverTags)[0];