| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- # 国内 Jenkins 默认走 DaoCloud 公共镜像代理(完整代理 docker.io/library),避免拉取超时
- # 可覆盖: docker build --build-arg NODE_IMAGE=node:20-alpine ...
- ARG NODE_IMAGE=docker.m.daocloud.io/library/node:20-alpine
- ARG PYTHON_IMAGE=docker.m.daocloud.io/library/python:3.11-slim
- # Stage 1: build frontend
- FROM ${NODE_IMAGE} AS web-builder
- WORKDIR /app/web
- COPY web/package.json web/package-lock.json ./
- RUN npm config set registry https://registry.npmmirror.com \
- && npm ci
- COPY web/ ./
- RUN npm run build
- # Stage 2: Python runtime
- FROM ${PYTHON_IMAGE}
- WORKDIR /app
- ENV PYTHONUNBUFFERED=1 \
- PYTHONDONTWRITEBYTECODE=1 \
- PIP_NO_CACHE_DIR=1 \
- PIP_DISABLE_PIP_VERSION_CHECK=1
- RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.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; s|security.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 ffmpeg \
- && ffmpeg -version >/dev/null \
- && ffprobe -version >/dev/null \
- && ffmpeg -hide_banner -loglevel error \
- -f lavfi -i testsrc=duration=2:size=160x120:rate=10 \
- -t 2 -c:v libx264 -pix_fmt yuv420p /tmp/verify_src.mp4 \
- && ffmpeg -hide_banner -loglevel error -y \
- -i /tmp/verify_src.mp4 -t 1 -c copy /tmp/verify_clip.mp4 \
- && test -s /tmp/verify_clip.mp4 \
- && rm -f /tmp/verify_src.mp4 /tmp/verify_clip.mp4 \
- && rm -rf /var/lib/apt/lists/*
- COPY pyproject.toml requirements.txt README.md ./
- COPY supply_agent/ supply_agent/
- COPY supply_infra/ supply_infra/
- COPY agents/ agents/
- COPY api/ api/
- COPY jobs/ jobs/
- COPY scripts/verify_video_truncate_runtime.py scripts/
- RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com ".[odps]" \
- && python scripts/verify_video_truncate_runtime.py
- COPY --from=web-builder /app/web/dist ./web/dist
- EXPOSE 8080
- CMD ["python", "-m", "api"]
|