This commit is contained in:
Dmitry 2026-01-05 01:18:43 +03:00
parent 44b0e1e73a
commit 446dfaad3c
2 changed files with 27 additions and 12 deletions

View file

@ -15,4 +15,6 @@ RUN npm ci --production
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
EXPOSE 3000 EXPOSE 3000
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/main"]
# Используем shell для лучшего логирования ошибок
CMD sh -c "echo '=== Starting Backend ===' && npx prisma migrate deploy && echo '=== Migrations completed ===' && node dist/main"

View file

@ -55,15 +55,28 @@ async function bootstrap() {
const port = configService.get<number>('PORT') || 3000; const port = configService.get<number>('PORT') || 3000;
const host = configService.get<string>('HOST') || '0.0.0.0'; const host = configService.get<string>('HOST') || '0.0.0.0';
await app.listen(port, host);
console.log(`=== Backend Started Successfully ===`); try {
console.log(`Backend running on http://${host}:${port}`); await app.listen(port, host);
console.log(`CORS allowed origins: ${allowedOrigins.join(', ')}`); console.log(`=== Backend Started Successfully ===`);
console.log(`Environment variables:`); console.log(`Backend running on http://${host}:${port}`);
console.log(` - DATABASE_URL: ${configService.get<string>('DATABASE_URL') ? 'SET' : 'NOT SET'}`); console.log(`CORS allowed origins: ${allowedOrigins.join(', ')}`);
console.log(` - JWT_SECRET: ${configService.get<string>('JWT_SECRET') ? 'SET' : 'NOT SET'}`); console.log(`Environment variables:`);
console.log(` - PORT: ${port}`); console.log(` - DATABASE_URL: ${configService.get<string>('DATABASE_URL') ? 'SET' : 'NOT SET'}`);
console.log(` - HOST: ${host}`); console.log(` - JWT_SECRET: ${configService.get<string>('JWT_SECRET') ? 'SET' : 'NOT SET'}`);
console.log(` - CORS_ORIGIN: ${corsOrigin}`); console.log(` - PORT: ${port}`);
console.log(` - HOST: ${host}`);
console.log(` - CORS_ORIGIN: ${corsOrigin}`);
} catch (error) {
console.error(`=== Backend Failed to Start ===`);
console.error(`Error: ${error.message}`);
console.error(error);
process.exit(1);
}
} }
bootstrap();
bootstrap().catch((error) => {
console.error('=== Fatal Error During Bootstrap ===');
console.error(error);
process.exit(1);
});