Files
ai-app-database/.env.docker.example
huty 3ad430e3e3 feat: 添加 Docker 容器化部署支持
支持两种部署模式,兼容新建 MySQL 和现有 MySQL:

- Dockerfile:Python 3.12-slim 两阶段构建,非 root 运行
- docker-compose.yml:全栈模式(含 MySQL 8.0 + 可选 Nginx)
- docker-compose.external-db.yml:接入现有 MySQL 模式
- docker/entrypoint.sh:自动等待 DB 就绪 → 初始化表 → 启动 Gunicorn
- docker/nginx.conf:反向代理 + 静态文件直出 + 安全响应头
- .env.docker.example / .env.external-db.example:各模式配置示例
- .gitattributes:确保 entrypoint.sh 在 Windows 上保持 LF 换行

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 00:38:14 +09:00

41 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ═══════════════════════════════════════════════════════════════
# 模式一:新建 MySQL 全栈部署
# 使用方式cp .env.docker.example .env.docker
# 编辑后执行docker compose --env-file .env.docker up -d
# ═══════════════════════════════════════════════════════════════
# ── 应用安全 ────────────────────────────────────────────────────
# 必须修改!使用随机长字符串
SECRET_KEY=change-this-to-a-very-long-random-string-in-production
# ── MySQL新建数据库配置──────────────────────────────────────
MYSQL_ROOT_PASSWORD=StrongRootPass@2026
MYSQL_DATABASE=resource_library
MYSQL_USER=resource_library
MYSQL_PASSWORD=StrongUserPass@2026
# 是否对外暴露 MySQL 端口(生产环境建议保持 127.0.0.1 限制)
# 仅本机访问(推荐): MYSQL_EXPOSE_PORT=127.0.0.1:3306
# 所有网络接口(开发调试): MYSQL_EXPOSE_PORT=3306
MYSQL_EXPOSE_PORT=127.0.0.1:3306
# ── 管理员账号(首次启动自动创建)────────────────────────────────
ADMIN_USERNAME=admin
ADMIN_PASSWORD=Admin@123456
ADMIN_EMAIL=admin@example.com
# ── 应用配置 ────────────────────────────────────────────────────
FLASK_ENV=production
APP_PORT=5000
MAX_UPLOAD_SIZE_MB=500
LOG_LEVEL=info
# ── Gunicorn ────────────────────────────────────────────────────
# 建议CPU 核心数 × 2 + 1
GUNICORN_WORKERS=4
GUNICORN_TIMEOUT=120
# ── Nginx--profile nginx 时生效)──────────────────────────────
NGINX_HTTP_PORT=80
NGINX_HTTPS_PORT=443