e0c3bae072
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 44s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 1m11s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
Worker Base Image Build / Build Worker Base Images (worker-base-builder-cache, infra/docker/worker-base-builder.Dockerfile, worker-base-builder, builder) (push) Failing after 3m41s
Worker Base Image Build / Build Worker Base Images (worker-base-runtime-cache, infra/docker/worker-base-runtime.Dockerfile, worker-base-runtime, runtime) (push) Failing after 1m11s
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Failing after 4m40s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / Build Staging API 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
44 lines
1.7 KiB
Docker
44 lines
1.7 KiB
Docker
# ============================================================
|
|
# Worker Builder 基础镜像
|
|
# 预编译:编译工具 + 基础依赖 + Worker大包
|
|
# 当 requirements-base.txt 或 requirements-worker.txt 变更时重新构建
|
|
# 业务构建从此镜像开始,只需要安装业务依赖,节省15+分钟
|
|
# ============================================================
|
|
|
|
FROM git.xiaoxiajianji.com/xiaoxia/base/python:3.12-slim
|
|
|
|
# 使用阿里云镜像加速
|
|
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
|
sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true
|
|
|
|
# 安装编译工具
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
g++ \
|
|
python3-dev \
|
|
binutils \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 创建 venv
|
|
RUN python -m venv /opt/venv
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
WORKDIR /tmp
|
|
|
|
# 基础依赖(变化极少)
|
|
COPY requirements-base.txt /tmp/requirements-base.txt
|
|
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
|
|
pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com \
|
|
-r /tmp/requirements-base.txt \
|
|
&& rm /tmp/requirements-base.txt
|
|
|
|
# Worker 大包(变化少)
|
|
COPY requirements-worker.txt /tmp/requirements-worker.txt
|
|
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
|
|
pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com \
|
|
-r /tmp/requirements-worker.txt \
|
|
&& rm /tmp/requirements-worker.txt
|
|
|
|
# 预先做一次 strip(基础层瘦身,业务层增量)
|
|
RUN find /opt/venv -name "*.so" -type f -exec strip --strip-all {} \; 2>/dev/null || true
|