fix: copy prisma.config.ts into runner so db push can find datasource URL

Without prisma.config.ts in the runner stage, prisma db push has no
datasource URL (schema.prisma no longer carries url in Prisma 7) and
silently skips creating the database. Also add set -e to the entrypoint
so any db push failure is visible in logs and stops the container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 00:44:41 -05:00
parent b1fa70eba4
commit cfeee5dc2a

View File

@@ -44,6 +44,7 @@ RUN chown nextjs:nodejs .next
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/prisma.config.ts ./prisma.config.ts
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
# Create data directory AFTER all copies so permissions are never clobbered # Create data directory AFTER all copies so permissions are never clobbered
@@ -58,7 +59,10 @@ ENV PORT=3000
# script to run migrations before starting # script to run migrations before starting
COPY --chown=nextjs:nodejs <<EOF /app/entrypoint.sh COPY --chown=nextjs:nodejs <<EOF /app/entrypoint.sh
#!/bin/sh #!/bin/sh
set -e
echo "Running prisma db push..."
npx prisma db push --accept-data-loss npx prisma db push --accept-data-loss
echo "Starting server..."
node server.js node server.js
EOF EOF