feat: initial project setup

- Add bot.py with core Telegram Contact Bot logic
- Add Dockerfile and docker-compose for containerization
- Add requirements.txt for dependency management
- Add .env.example for environment configuration
This commit is contained in:
EchoZenith
2026-01-25 20:19:56 +08:00
parent 37ac5383cb
commit a4760bc373
5 changed files with 145 additions and 0 deletions

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
# 使用轻量级的 Python 镜像
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 先复制依赖文件并安装(利用缓存机制)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制脚本代码
COPY bot.py .
# 创建一个数据卷目录,防止数据库在容器删除时丢失
VOLUME /app/data
# 修改脚本中的数据库路径(建议在脚本里将 DB_FILE 改为 /app/data/messages.db
ENV DB_PATH=/app/data/messages.db
# 启动命令
CMD ["python", "bot.py"]