| 123456789101112131415161718192021222324252627 |
- FROM registry.cn-hangzhou.aliyuncs.com/stuuudy/python:3.11-slim AS base
- WORKDIR /app
- ENV PYTHONDONTWRITEBYTECODE=1 \
- PYTHONUNBUFFERED=1 \
- TZ=Asia/Shanghai \
- PYTHONPATH=/app
- # 安装编译工具链(pyodps 等依赖构建 wheel 可能需要 gcc)
- RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
- apt-get update && \
- apt-get install -y --no-install-recommends gcc g++ libc6-dev tzdata && \
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
- echo $TZ > /etc/timezone && \
- rm -rf /var/lib/apt/lists/*
- # 1) 安装依赖(利用 Docker layer 缓存)
- COPY requirements.txt /app/requirements.txt
- RUN pip install --no-cache-dir --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple/ && \
- pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
- # 2) 仅复制运行所需源码,避免工作区临时文件进入镜像
- COPY app /app/app
- # 定时任务调度:热点搜索(6/12/18) + 解构后处理(30分钟) + ODPS 需求表写入
- CMD ["python", "-m", "app.scheduler"]
|