Files
abot/docker-entrypoint.sh
liuwei 9589846113 完善 Docker 部署骨架并整理开源发布资料
- 调整 Dockerfile 与入口脚本,拆分应用、MySQL、Redis 的部署职责
- 新增 docker-compose、docker ignore 与 Docker 环境变量示例
- 重写 README 并补充 Docker 部署说明与第三方资产说明
- 将后台示例账号与 webhook token 改为安全占位值,移除弱口令默认兜底
2026-05-06 14:44:49 +08:00

70 lines
2.1 KiB
Bash
Raw 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.
#!/usr/bin/env bash
set -euo pipefail
mkdir -p /app/logs
# 首次启动时自动生成最小可运行配置:
# 1. 若用户已经通过挂载文件提供 config.yaml则完全尊重现有配置
# 2. 若未提供,则根据 .env / compose 环境变量生成一份安全模板;
# 3. 模板中的敏感值继续走环境变量占位,避免把真实密钥写进镜像层。
if [ ! -f /app/config.yaml ]; then
cat > /app/config.yaml <<EOF
environment: "\${ABOT_ENVIRONMENT:production}"
plugin_dir: "\${ABOT_PLUGIN_DIR:plugins}"
db_config:
pool_name: "\${ABOT_DB_POOL_NAME:wechat_boot_pool}"
pool_size: "\${ABOT_DB_POOL_SIZE:10}"
host: "\${ABOT_DB_HOST:127.0.0.1}"
port: "\${ABOT_DB_PORT:3306}"
prot: "\${ABOT_DB_PORT:3306}"
user: "\${ABOT_DB_USER:root}"
password: "\${ABOT_DB_PASSWORD}"
database: "\${ABOT_DB_NAME:message_archive}"
charset: "utf8mb4"
use_unicode: true
get_warnings: true
pool_reset_session: true
redis_config:
host: "\${ABOT_REDIS_HOST:127.0.0.1}"
port: "\${ABOT_REDIS_PORT:6379}"
password: "\${ABOT_REDIS_PASSWORD:}"
db: "\${ABOT_REDIS_DB:0}"
decode_responses: true
email_config:
smtp_server: "\${ABOT_EMAIL_SMTP_SERVER:smtp.163.com}"
smtp_port: "\${ABOT_EMAIL_SMTP_PORT:465}"
sender_email: "\${ABOT_EMAIL_SENDER:}"
sender_password: "\${ABOT_EMAIL_PASSWORD:}"
alert_recipient: "\${ABOT_EMAIL_ALERT_RECIPIENT:}"
glances:
host: "\${ABOT_GLANCES_HOST:127.0.0.1}"
port: "\${ABOT_GLANCES_PORT:61208}"
wx_config:
admin: [ "\${ABOT_WX_ADMIN:admin}" ]
EOF
fi
# wechat_ipad 配置保留为独立文件:
# 1. 兼容现有代码对 wechat_ipad/config.toml 的读取方式;
# 2. 仅在文件缺失时生成,避免覆盖用户已有的登录态与设备信息;
# 3. 这样既支持 Docker 一键部署,也不强行改动用户本地运行方式。
mkdir -p /app/wechat_ipad
if [ ! -f /app/wechat_ipad/config.toml ]; then
cat > /app/wechat_ipad/config.toml <<EOF
server_url = "${WECHAT_SERVER_URL}"
wxid = "${WECHAT_WXID}"
device_id = "${WECHAT_DEVICE_ID}"
device_name = "${WECHAT_DEVICE_NAME}"
server_ip = "${WECHAT_SERVER_IP}"
server_port = "${WECHAT_SERVER_PORT}"
login_time = ""
EOF
fi
exec "$@"