ak13/Dockerfile
cheney 837fc10d7d
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m48s
触发 CI
2025-07-22 11:32:04 +08:00

28 lines
814 B
Docker
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.

# 使用 Python 3.13 的基础镜像注意3.13可能尚未正式发布,这里使用可能的最新开发版本)
FROM python:3.13-rc-slim
# 安装必要的软件包
RUN apt-get update && \
apt-get install -y --no-install-recommends cron && \
rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 复制Python脚本和其他必要文件
COPY *.py /app/
COPY cronjob /etc/cron.d/cronjob
# 设置cron作业文件权限
RUN chmod 0644 /etc/cron.d/cronjob && \
crontab /etc/cron.d/cronjob
# 安装Python依赖如果有
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 创建日志文件用于cron输出
RUN touch /var/log/cron.log
# 保持容器运行的命令
CMD tail -f /var/log/cron.log