FROM node:22-slim

RUN corepack enable

WORKDIR /app
COPY . .
RUN pnpm install
RUN pnpm --filter @streamclipper/db exec prisma generate

# DATABASE_URL isn't needed for real at build time (all pages are
# force-dynamic — nothing queries the DB during `next build`), but
# Prisma's client validates the connection string format at import, so a
# well-formed placeholder keeps the build step from failing. Coolify's
# actual DATABASE_URL is supplied as a runtime env var and overrides this.
ENV DATABASE_URL="postgresql://build:build@localhost:5432/build"
RUN pnpm --filter @streamclipper/frontend build

CMD ["pnpm", "--filter", "@streamclipper/frontend", "start"]
