Files
xiaoxia-saas/infra/docker/worker.Dockerfile
xiaoxia c21c0fb748
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m39s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m45s
CI/CD Pipeline / Build Staging API Image (push) Successful in 3m13s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m14s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 4m31s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 9m38s
CI/CD Pipeline / Unit Tests (push) Successful in 11m35s
CI/CD Pipeline / Integration Tests (push) Successful in 3m31s
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
Worker Base Image Build / Build Worker Base Image (push) Successful in 35m41s
CI/CD Pipeline / CI Gate (push) Failing after 688h8m29s
CI/CD Pipeline / Deploy Production (push) Failing after 688h10m2s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 688h10m4s
CI/CD Pipeline / Build Production API Image (push) Failing after 688h10m4s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 688h18m58s
CI/CD Pipeline / PR Build API Image (push) Failing after 688h19m2s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 688h21m41s
CI/CD Pipeline / Frontend Lint (push) Failing after 688h21m40s
CI/CD Pipeline / Production Browser E2E (push) Failing after 688h43m43s
CI/CD Pipeline / Build Production Web Image (push) Failing after 688h43m47s
CI/CD Pipeline / PR Build Web Image (push) Failing after 688h52m43s
perf(worker): optimize worker image build with unified base image (#1430)
2026-08-18 23:04:43 +08:00

44 lines
1.4 KiB
Docker
Executable File
Raw Permalink 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/packages
ENV PYTHONUNBUFFERED=1
ENV APP_VERSION=$APP_VERSION
# 复制文件(按变化频率从低到高排序,最大化层缓存命中)
COPY alembic.ini /app/alembic.ini
COPY migrations/ /app/migrations/
COPY packages/ /app/packages/
COPY apps/api/app/config.py /app/apps/api/app/config.py
COPY apps/api/app/core/ /app/apps/api/app/core/
# 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/
USER celery
WORKDIR /app/apps/worker
CMD ["/usr/local/bin/entrypoint-worker.sh"]