minor changes to Deployment

This commit is contained in:
nocnico
2025-05-26 22:10:52 +02:00
parent 3489b1f57a
commit a8a94d032f
5 changed files with 55 additions and 62 deletions

View File

@@ -1,24 +1,18 @@
FROM node:22-alpine AS base
ENV PNPM_HOME="/usr/local/pnpm"
ENV PATH="${PNPM_HOME}:${PATH}"
RUN corepack enable && corepack prepare pnpm@latest --activate
RUN pnpm add -g turbo@^2.5
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
FROM base AS builder
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /usr/app
COPY . .
RUN cat .env.prod
RUN turbo prune dispatch --docker
@@ -34,9 +28,6 @@ RUN pnpm install --frozen-lockfile
# Build the project
COPY --from=builder /usr/app/out/full/ .
COPY --from=builder /usr/app/.env.prod ./apps/dispatch/.env
COPY --from=builder /usr/app/.env.prod ./packages/databse/.env
RUN turbo run build
FROM base AS runner
@@ -52,6 +43,6 @@ USER nextjs
COPY --from=installer --chown=nextjs:nodejs /usr/app/ ./
# Expose the application port
EXPOSE 3000
EXPOSE 3001
CMD ["pnpm", "--dir", "apps/dispatch", "run", "start"]

View File

@@ -4,20 +4,18 @@ import { AccessToken } from "livekit-server-sdk";
import { NextRequest } from "next/server";
import { prisma } from "@repo/db";
if (!process.env.LIVEKIT_API_KEY) throw new Error("LIVEKIT_API_KEY not set");
/* if (!process.env.LIVEKIT_API_KEY) throw new Error("LIVEKIT_API_KEY not set");
if (!process.env.LIVEKIT_API_SECRET)
throw new Error("LIVEKIT_API_SECRET not set");
throw new Error("LIVEKIT_API_SECRET not set"); */
export const GET = async (request: NextRequest) => {
const roomName = request.nextUrl.searchParams.get("roomName");
if (!roomName)
return Response.json({ message: "Missing roomName" }, { status: 400 });
if (!roomName) return Response.json({ message: "Missing roomName" }, { status: 400 });
const session = await getServerSession();
if (!session)
return Response.json({ message: "Unauthorized" }, { status: 401 });
if (!session) return Response.json({ message: "Unauthorized" }, { status: 401 });
const user = await prisma.user.findUnique({
where: {
id: session.user.id,
@@ -29,15 +27,11 @@ export const GET = async (request: NextRequest) => {
const participantName = user.publicId;
const at = new AccessToken(
process.env.LIVEKIT_API_KEY,
process.env.LIVEKIT_API_SECRET,
{
identity: participantName,
// Token to expire after 10 minutes
ttl: "1d",
},
);
const at = new AccessToken(process.env.LIVEKIT_API_KEY, process.env.LIVEKIT_API_SECRET, {
identity: participantName,
// Token to expire after 10 minutes
ttl: "1d",
});
at.addGrant({
room: roomName,