添加执行需要的文件

This commit is contained in:
2026-03-24 17:00:14 +08:00
parent 6a6ef44132
commit 15b6f0525e
4 changed files with 66 additions and 16 deletions
+27 -12
View File
@@ -1,14 +1,15 @@
FROM python:3.12-slim FROM ghcr.io/astral-sh/uv:latest AS uv
ENV PYTHONDONTWRITEBYTECODE=1 \ FROM python:3.12-slim-bookworm
PYTHONUNBUFFERED=1 \
COPY --from=uv /uv /bin/uv
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_SYSTEM_PYTHON=1 \ UV_SYSTEM_PYTHON=1 \
UV_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple" \ UV_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple" \
TZ=Asia/Shanghai TZ=Asia/Shanghai \
PYTHONPATH="/app:${PYTHONPATH}"
WORKDIR /app
COPY requirements-docker.txt /app/requirements-docker.txt
RUN echo "# 清华大学 Debian 镜像源配置\n\ RUN echo "# 清华大学 Debian 镜像源配置\n\
# 主软件源\n\ # 主软件源\n\
@@ -23,12 +24,26 @@ deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n\ deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n\
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" > /etc/apt/sources.list deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" > /etc/apt/sources.list
RUN pip install --no-cache-dir --upgrade pip \ RUN apt-get update && apt-get install -y --no-install-recommends \
&& pip install --no-cache-dir -r /app/requirements-docker.txt supervisor \
tzdata \
&& ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY pyproject.toml /app/pyproject.toml
RUN uv pip install -r /app/pyproject.toml
COPY . /app COPY . /app
RUN chmod +x /app/docker-entrypoint.sh RUN chmod +x /app/docker-entrypoint.sh \
&& mkdir -p /app/logs \
&& mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ENTRYPOINT ["/app/docker-entrypoint.sh"] ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["python", "prefect_gmv_scheduler.py", "--serve"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
+4 -4
View File
@@ -22,11 +22,11 @@ deployments:
- bitable - bitable
- sync - sync
schedules: schedules:
- cron: "0 17 * * *" - cron: "0 17 10 * *"
timezone: "Asia/Shanghai" timezone: "Asia/Shanghai"
active: true active: true
work_pool: work_pool:
name: default-agent-pool name: gmv-analytics-pool
- name: gmv-daily-notify-9am - name: gmv-daily-notify-9am
version: "1.0.0" version: "1.0.0"
@@ -43,8 +43,8 @@ deployments:
- feishu - feishu
- notify - notify
schedules: schedules:
- cron: "0 17 40 * *" - cron: "0 17 50 * *"
timezone: "Asia/Shanghai" timezone: "Asia/Shanghai"
active: true active: true
work_pool: work_pool:
name: default-agent-pool name: gmv-analytics-pool
+25
View File
@@ -0,0 +1,25 @@
[project]
name = "prefect-etl-worker"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"httpx>=0.25.0",
"openpyxl>=3.1.2",
"pandas",
"prefect==3.6.8",
"psycopg2-binary>=2.9.9",
"python-dotenv>=1.2.1",
"python-socks>=2.7.3",
"requests>=2.31.0",
"pendulum>=3.1.0",
"psycopg-pool>=3.3.0",
"psycopg>=3.3.1",
"psycopg-binary>=3.3.1"
]
[dependency-groups]
dev = [
"pytest>=9.0.2",
]
+10
View File
@@ -0,0 +1,10 @@
[supervisord]
nodaemon=true
[program:gmv-analytics-worker]
command=prefect worker start --pool "gmv-analytics-pool" --type process
directory=/app
autostart=true
autorestart=true
stderr_logfile=/app/logs/prefect_worker.err.log
stdout_logfile=/app/logs/prefect_worker.out.log