fix: 去掉 start.sh,CMD 内联启动逻辑(彻底解决权限问题)

This commit is contained in:
胡旭
2026-06-25 08:21:32 +08:00
parent 707d065edb
commit 0268048c62
2 changed files with 1 additions and 15 deletions
+1 -3
View File
@@ -37,8 +37,6 @@ COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY start.sh ./start.sh
# 数据库持久化目录
RUN mkdir -p /app/prisma && chown -R nextjs:nodejs /app
@@ -47,4 +45,4 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["sh", "./start.sh"]
CMD ["sh", "-c", "npx prisma db push --skip-generate 2>/dev/null; node server.js"]
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
# 启动前确保数据库表存在
node -e "
const { execSync } = require('child_process');
try {
execSync('npx prisma db push --skip-generate', { stdio: 'inherit' });
} catch (e) {
console.error('prisma db push failed:', e.message);
}
"
# 启动应用
exec node server.js