mirror of
https://github.com/EchoZenith/TelegramContactBot.git
synced 2026-02-09 18:05:20 +00:00
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:
22
Dockerfile
Normal file
22
Dockerfile
Normal 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"]
|
||||
|
||||
Reference in New Issue
Block a user