From 1b63f62ca0c463eea190a132aaad816c1f33dde9 Mon Sep 17 00:00:00 2001 From: maaz519 Date: Tue, 9 Jun 2026 16:47:54 +0530 Subject: [PATCH] fix: add retry loop for database connection in entrypoint --- apps/api/Dockerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 04fc011..c24a608 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -20,11 +20,21 @@ RUN pnpm install --frozen-lockfile FROM installer AS builder COPY --from=pruner /app/out/full/ . COPY tsconfig.base.json ./ + +# Generate Prisma client RUN pnpm exec prisma generate --schema=apps/api/prisma/schema.prisma -# Build internal workspace packages that api depends on first -RUN pnpm turbo build --filter=@tower/config --filter=@tower/logger --filter=@tower/search --filter=@tower/types -# Build the api itself using nest CLI directly from the package directory -RUN cd apps/api && pnpm exec nest build + +# Build internal workspace packages that api depends on (in dependency order) +RUN pnpm --filter @tower/types run build +RUN pnpm --filter @tower/config run build +RUN pnpm --filter @tower/logger run build +RUN pnpm --filter @tower/search run build + +# Build the API via its package script (runs nest build from apps/api/) +RUN pnpm --filter @tower/api run build + +# Hard verify: fail the Docker build if dist wasn't produced +RUN test -f apps/api/dist/main.js || (echo "ERROR: apps/api/dist/main.js not found after build!" && exit 1) # ─── Production runner ─── FROM node:22-alpine AS runner