Files
xiaoxia-saas/infra/docker/worker.Dockerfile
T
xiaoxia 582f73c2f2
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 1s
CI/CD Pipeline / Check push changed paths (push) Successful in 9s
CI/CD Pipeline / Build Staging API Image (push) Successful in 20s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m1s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 1m13s
CI/CD Pipeline / Integration Tests (push) Successful in 1m36s
CI/CD Pipeline / Validate - Style (push) Successful in 2m23s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m46s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 3m36s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m35s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m33s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 2m9s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m15s
CI/CD Pipeline / Unit Tests (push) Successful in 8m11s
CI/CD Pipeline / Validate - Security (push) Successful in 24m36s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Failing after 136h2m30s
CI/CD Pipeline / Build Production API Image (push) Failing after 136h2m34s
CI/CD Pipeline / PR Build Web Image (push) Failing after 136h27m8s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 136h26m54s
CI/CD Pipeline / PR Build API Image (push) Failing after 136h26m55s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Failing after 136h25m19s
CI/CD Pipeline / Retag skipped Staging API Image (push) Failing after 136h25m19s
CI/CD Pipeline / CI Gate (push) Failing after 136h2m21s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 136h25m19s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 136h27m0s
CI/CD Pipeline / Build Production Web Image (push) Failing after 136h2m21s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 136h2m21s
CI/CD Pipeline / Canary Release to Production (push) Failing after 136h2m17s
CI/CD Pipeline / Frontend Lint (push) Failing after 136h26m55s
fix(worker): 修复 worker 镜像漏 COPY apps/api/app 目录导致转码队列不消费(Staging E2E 阻塞) (#1850)
2026-09-10 22:56:39 +08:00

50 lines
1.8 KiB
Docker
Executable File
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.
# ============================================================
# Worker Dockerfile - 极简化
# 从预构建统一基础镜像开始,仅叠加业务代码
# 基础镜像包含:系统依赖 + 全部 Python 依赖 + CJK 字体
# 构建时间目标:< 5 分钟
# ============================================================
FROM xiaoxia-registry.cn-hangzhou.cr.aliyuncs.com/xiaoxiakeji/saas-worker-base:latest
# 构建参数:版本号(CI 传入 commit hash)
ARG APP_VERSION=dev
# 创建非 root 用户
RUN groupadd -r celery \
&& useradd -r -g celery -d /app -s /sbin/nologin celery \
&& mkdir -p /app/generated \
&& chown celery:celery /app/generated
WORKDIR /app
# 设置 Python 环境变量
ENV PATH="/opt/venv/bin:$PATH"
ENV PYTHONPATH=/app:/app/apps/api:/app/packages
ENV PYTHONUNBUFFERED=1
ENV APP_VERSION=$APP_VERSION
# 复制文件(按变化频率从低到高排序,最大化层缓存命中)
COPY alembic.ini /app/alembic.ini
COPY migrations/ /app/migrations/
COPY packages/ /app/packages/
# PR #1844 起,worker 还需要加载 apps.api.app.tasks.lipsync_tts,
# 该 task 依赖 app.services.* 与 app.core.celery_app(PYTHONPATH=/app/apps/api 下解析)。
# 为避免后续新增 task 再次漏 COPY,直接把整个 apps/api/app/ 复制进 worker 镜像。
COPY apps/api/app/ /app/apps/api/app/
# Worker 启动脚本
COPY infra/docker/entrypoint-worker.sh /usr/local/bin/entrypoint-worker.sh
RUN chmod +x /usr/local/bin/entrypoint-worker.sh
# 业务代码(变化最频繁,放最后)
COPY apps/worker/ /app/apps/worker/
# 健康检查:扫描所有进程的 cmdline 查找 celery 进程
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD grep -lq celery /proc/[0-9]*/cmdline 2>/dev/null || exit 1
USER celery
WORKDIR /app/apps/worker
CMD ["/usr/local/bin/entrypoint-worker.sh"]