alpine sucks sometimes
All checks were successful
Build and deploy / deploy (push) Successful in 1m23s
All checks were successful
Build and deploy / deploy (push) Successful in 1m23s
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Use the official Node.js image as the base image
|
# 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
|
# Set the working directory inside the container
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function DockerRow({
|
|||||||
}: {
|
}: {
|
||||||
containerInfo: dockerRouterType["list"][number];
|
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;
|
const outdated = containerInfo.image.current.hash !== latest?.latest.hash;
|
||||||
|
|
||||||
let latestFragment: JSX.Element | null = null;
|
let latestFragment: JSX.Element | null = null;
|
||||||
@@ -52,7 +52,7 @@ function DockerRow({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function DockerTable() {
|
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 (
|
return (
|
||||||
<div className="overflow-x-auto rounded-md border border-base-content/15 bg-base-100">
|
<div className="overflow-x-auto rounded-md border border-base-content/15 bg-base-100">
|
||||||
{!listLoading ? (
|
{!listLoading ? (
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const dockerRouter = createTRPCRouter({
|
|||||||
|
|
||||||
const container = containers.find((container) => container.Id === input.id);
|
const container = containers.find((container) => container.Id === input.id);
|
||||||
if (!container) {
|
if (!container) {
|
||||||
|
console.error(`Container with id ${input.id} not found`);
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "NOT_FOUND",
|
code: "NOT_FOUND",
|
||||||
message: `Container with id ${input.id} 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),
|
latest: await getLatest(imageData.name, imageData.tag),
|
||||||
};
|
};
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
console.error(ex);
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "INTERNAL_SERVER_ERROR",
|
code: "INTERNAL_SERVER_ERROR",
|
||||||
message: (ex as Error).message,
|
message: (ex as Error).message,
|
||||||
@@ -159,9 +161,10 @@ function isSemver(tag: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getHash(image: string) {
|
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);
|
const hash = latestImage.split(":")?.[1]?.substring(0, 12);
|
||||||
if (!hash) {
|
if (!hash) {
|
||||||
|
console.error(`Hash not found: ${latestImage}`);
|
||||||
throw new Error("Hash not found", {
|
throw new Error("Hash not found", {
|
||||||
cause: {
|
cause: {
|
||||||
imageDigest: latestImage,
|
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 }> {
|
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.*
|
const allTags =
|
||||||
' --exclude 'amd.*' ${image}`.text();
|
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 semverTags = allTags.split("\n").filter((tag) => isSemver(tag));
|
||||||
const newestTag = semver.rsort(semverTags)[0];
|
const newestTag = semver.rsort(semverTags)[0];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user