feat: 添加 Docker 部署支持和多 OCR 提供商架构
- 添加完整的 Docker 配置 (Dockerfile, docker-compose.yml) - 修复前端硬编码端口 4000,改用相对路径 /api - 实现多 OCR 提供商架构 (Tesseract.js/Baidu/RapidOCR) - 修复 Docker 环境中图片上传路径问题 - 添加用户设置页面和 AI 分析服务 - 更新 Prisma schema 支持 AI 分析结果 - 添加部署文档和 OCR 配置指南 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
22
backend/docker-entrypoint.sh
Normal file
22
backend/docker-entrypoint.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ensure data directory exists with proper permissions
|
||||
mkdir -p /app/data
|
||||
chown -R nodejs:nodejs /app/data
|
||||
|
||||
# Set database path to data directory
|
||||
export DATABASE_URL="file:/app/data/prod.db"
|
||||
|
||||
# Run Prisma migrations (as root, then switch to nodejs)
|
||||
echo "Running database migrations..."
|
||||
npx prisma db push --skip-generate || echo "Database push failed, will try on startup..."
|
||||
|
||||
# Fix database file permissions after creation
|
||||
if [ -f /app/data/prod.db ]; then
|
||||
chown nodejs:nodejs /app/data/prod.db
|
||||
chmod 664 /app/data/prod.db
|
||||
fi
|
||||
|
||||
# Start the application as nodejs user
|
||||
echo "Starting application..."
|
||||
exec su-exec nodejs npx tsx src/index.ts
|
||||
Reference in New Issue
Block a user