fix(backup-service): 添加 tsx 支持 Prisma 7 配置文件

- 安装 tsx 以便在生产环境运行 prisma.config.ts
- 复制 prisma.config.ts 到生产镜像
- 移除 --url 参数 (Prisma 7 不再支持)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Developer 2025-12-04 03:07:07 -08:00
parent 9819661693
commit 613d822c46
1 changed files with 4 additions and 1 deletions

View File

@ -32,14 +32,17 @@ RUN addgroup -g 1001 -S nodejs && \
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production && npm cache clean --force
# Also install tsx for Prisma 7 config file support
RUN npm ci --only=production && npm install tsx && npm cache clean --force
# Copy built application
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./
# Create startup script that runs migrations before starting the app
# For Prisma 7, tsx is required to run prisma.config.ts
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy || npx prisma db push --accept-data-loss\necho "Starting application..."\nexec node dist/src/main.js\n' > /app/start.sh && chmod +x /app/start.sh
# Set ownership