tg / Dockerfile
l-g-t's picture
Update Dockerfile
0953763 verified
raw
history blame contribute delete
859 Bytes
# 将基础镜像从 3.9 升级到 3.11 或更高版本
FROM python:3.11-slim
WORKDIR /app
# 安装 git
RUN apt-get update && apt-get install -y git htop curl wget vim net-tools unzip iputils-ping telnet && rm -rf /var/lib/apt/lists/*
#RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# 1. 克隆代码到临时目录
RUN git clone https://github.com/H-T-H/Gemini-Telegram-Bot.git /tmp/bot_repo
# 2. 将代码内容移动到工作目录 /app
RUN mv /tmp/bot_repo/* .
RUN mv /tmp/bot_repo/.* . || true
RUN rm -rf /tmp/bot_repo
# 3. 安装依赖 (此时 requirements.txt 在 /app/ 下)
RUN pip install --no-cache-dir -r requirements.txt && pip install flask
# 4. 复制启动脚本 start.sh 和 app.py
COPY start.sh .
COPY app.py .
# 给予执行权限
RUN chmod +x start.sh
# 最终启动命令
CMD ["/bin/bash", "start.sh"]