feat: adjust docker image build

This commit is contained in:
engigu
2025-12-23 11:07:59 +08:00
parent 6f877fa3bd
commit 8fc9d5fffe
2 changed files with 18 additions and 10 deletions
+15 -4
View File
@@ -1,22 +1,33 @@
#!/bin/sh
# 创建必要的目录
# ============================
# 激活 Python 虚拟环境
# ============================
if [ -d /opt/venv ]; then
export PATH="/opt/venv/bin:$PATH"
fi
# ============================
# 创建必要目录
# ============================
mkdir -p /app/data /app/data/scripts /app/configs
# 如果数据库文件存在,设置不可变属性防止误删
# ============================
# 设置不可变属性
# ============================
if [ -f /app/data/ql.db ]; then
chattr +i /app/data/ql.db 2>/dev/null || true
fi
# 如果 configs 目录存在,设置不可变属性
if [ -d /app/configs ]; then
chattr +i /app/configs 2>/dev/null || true
fi
# 如果 scripts 目录存在,设置不可变属性
if [ -d /app/data/scripts ]; then
chattr +i /app/data/scripts 2>/dev/null || true
fi
# ============================
# 启动应用
# ============================
exec ./baihu