fix(mining-service): 添加Dockerfile构建验证步骤

This commit is contained in:
hailin 2026-01-14 03:45:51 -08:00
parent 2b083991d0
commit 0abc04b9cb
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,7 @@ RUN npm ci
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
COPY src ./src
RUN npm run build
RUN npm run build && ls -la dist/ && test -f dist/main.js && echo "Build successful: dist/main.js exists"
# 阶段2: 生产运行
FROM node:20-alpine AS runner
@ -37,6 +37,7 @@ COPY --chown=nestjs:nodejs prisma ./prisma/
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
COPY --chown=nestjs:nodejs --from=builder /app/dist ./dist
RUN ls -la dist/ && test -f dist/main.js && echo "Copy successful: dist/main.js exists"
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy\necho "Running database seed..."\nnpx prisma db seed || echo "Seed skipped or already applied"\necho "Starting application..."\nexec node dist/main.js\n' > /app/start.sh && chmod +x /app/start.sh