improvement(code-structure): move db into separate package (#1364)

* improvement(code-structure): move db into separate package

* make db separate package

* remake bun lock

* update imports to not maintain two separate ones

* fix CI for tests by adding dummy url

* vercel build fix attempt

* update bun lock

* regenerate bun lock

* fix mocks

* remove db commands from apps/sim package json
This commit is contained in:
Vikhyath Mondreti
2025-09-17 15:41:13 -07:00
committed by GitHub
parent 325a666a8b
commit 9de7a00373
400 changed files with 1054 additions and 966 deletions

View File

@@ -6,11 +6,11 @@ WORKDIR /app
# Copy only package files needed for migrations
COPY package.json bun.lock turbo.json ./
COPY apps/sim/package.json ./apps/sim/db/
COPY packages/db/package.json ./packages/db/package.json
# Install minimal dependencies in one layer
RUN bun install --omit dev --ignore-scripts && \
bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env zod @t3-oss/env-nextjs
bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres
# ========================================
# Runner Stage: Production Environment
@@ -20,9 +20,7 @@ WORKDIR /app
# Copy only the necessary files from deps
COPY --from=deps /app/node_modules ./node_modules
COPY apps/sim/drizzle.config.ts ./apps/sim/drizzle.config.ts
COPY apps/sim/db ./apps/sim/db
COPY apps/sim/package.json ./apps/sim/package.json
COPY apps/sim/lib/env.ts ./apps/sim/lib/env.ts
COPY packages/db/drizzle.config.ts ./packages/db/drizzle.config.ts
COPY packages/db ./packages/db
WORKDIR /app/apps/sim
WORKDIR /app/packages/db

View File

@@ -36,8 +36,9 @@ WORKDIR /app
ENV NODE_ENV=production
# Copy the entire sim app since socket-server has dependencies on other modules
# Copy the sim app and the shared db package needed by socket-server
COPY --from=builder /app/apps/sim ./apps/sim
COPY --from=builder /app/packages/db ./packages/db
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json