Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
brnovasco committed May 21, 2024
2 parents 131861e + d6aa14a commit f72bcc3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
15 changes: 15 additions & 0 deletions apps/deepsirius-ui/src/pages/hello.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { api } from '~/utils/api';

export default function Page() {
const { data, isLoading } = api.tbConsumer.hello.useQuery();

if (isLoading) {
return <div>Loading...</div>;
}

return (
<div className="flex p-4">
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
);
}
16 changes: 13 additions & 3 deletions apps/deepsirius-ui/src/server/api/routers/tb_consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export const tbConsumerRouter = createTRPCRouter({
)
.query(async ({ input }) => {
const url = `${env.TENSORBOARD_API_URL}/api/tensorboard/start`;

const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': env.TENSORBOARD_API_KEY,
'x-api-key': env.TENSORBOARD_API_KEY,
},
body: JSON.stringify(input),
});
Expand All @@ -45,9 +44,20 @@ export const tbConsumerRouter = createTRPCRouter({
message: error.message,
});
}

const parsed = TensorboardResponseSchema.parse(data);

return parsed;
}),
hello: protectedProcedure.query(async () => {
const url = `${env.TENSORBOARD_API_URL}/api/`;
const res = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': env.TENSORBOARD_API_KEY,
},
});

const data: unknown = await res.json();
return data;
}),
});
33 changes: 17 additions & 16 deletions apps/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# Builder
FROM node:alpine AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
FROM node:18-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable


# ----
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
RUN yarn global add turbo
RUN pnpm add --global turbo
COPY . .
RUN turbo prune @deepsirius-ui/docs --docker

# Installer
FROM node:alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update

FROM deps AS installer
WORKDIR /app
RUN yarn global add pnpm
RUN yarn global add turbo

COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
COPY --from=deps /app/out/json/ .
COPY --from=deps /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=deps /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm install

COPY --from=builder /app/out/full/ .
COPY --from=deps /app/out/full/ .
COPY turbo.json turbo.json

RUN turbo build --filter=@deepsirius-ui/docs...

# Runner
FROM node:alpine AS runner
FROM base AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
Expand Down

0 comments on commit f72bcc3

Please sign in to comment.