forked from hazem/yslootahrobotics
feat: update Dockerfile to include Prisma seed script and enhance entrypoint for seeding
feat: migrate middleware logic to new proxy.ts file for improved structure
This commit is contained in:
parent
45ffd33d39
commit
dc99abad37
@ -38,9 +38,10 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
|
||||||
# ── Prisma runtime ─────────────────────────────────────────────────────────────
|
# ── Prisma runtime ─────────────────────────────────────────────────────────────
|
||||||
# Config + schema (read by CLI at container startup for db push)
|
# Config, schema, and seed script
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/prisma.config.ts ./
|
COPY --from=builder --chown=nextjs:nodejs /app/prisma.config.ts ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/prisma/schema.prisma ./prisma/
|
COPY --from=builder --chown=nextjs:nodejs /app/prisma/schema.prisma ./prisma/
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/prisma/seed.ts ./prisma/
|
||||||
|
|
||||||
# Generated Prisma client (imported by the compiled Next.js server bundle)
|
# Generated Prisma client (imported by the compiled Next.js server bundle)
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/src/generated ./src/generated
|
COPY --from=builder --chown=nextjs:nodejs /app/src/generated ./src/generated
|
||||||
|
|||||||
@ -9,5 +9,8 @@ echo "→ Syncing database schema..."
|
|||||||
# db push creates the SQLite file and syncs tables to match schema.prisma
|
# db push creates the SQLite file and syncs tables to match schema.prisma
|
||||||
/app/node_modules/.bin/prisma db push
|
/app/node_modules/.bin/prisma db push
|
||||||
|
|
||||||
|
echo "→ Seeding database (idempotent — skips existing records)..."
|
||||||
|
/app/node_modules/.bin/tsx /app/prisma/seed.ts
|
||||||
|
|
||||||
echo "→ Starting Next.js on port ${PORT:-3000}..."
|
echo "→ Starting Next.js on port ${PORT:-3000}..."
|
||||||
exec node /app/server.js
|
exec node /app/server.js
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user