Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # 国内 Jenkins 默认走 DaoCloud 公共镜像代理(完整代理 docker.io/library),避免拉取超时
  2. # 可覆盖: docker build --build-arg NODE_IMAGE=node:20-alpine ...
  3. ARG NODE_IMAGE=docker.m.daocloud.io/library/node:20-alpine
  4. ARG PYTHON_IMAGE=docker.m.daocloud.io/library/python:3.11-slim
  5. # Stage 1: build frontend
  6. FROM ${NODE_IMAGE} AS web-builder
  7. WORKDIR /app/web
  8. COPY web/package.json web/package-lock.json ./
  9. RUN npm config set registry https://registry.npmmirror.com \
  10. && npm ci
  11. COPY web/ ./
  12. RUN npm run build
  13. # Stage 2: Python runtime
  14. FROM ${PYTHON_IMAGE}
  15. WORKDIR /app
  16. ENV PYTHONUNBUFFERED=1 \
  17. PYTHONDONTWRITEBYTECODE=1 \
  18. PIP_NO_CACHE_DIR=1 \
  19. PIP_DISABLE_PIP_VERSION_CHECK=1 \
  20. TZ=Asia/Shanghai \
  21. SCHEDULER_TIMEZONE=Asia/Shanghai \
  22. SCHEDULER_CRON_HOUR=15 \
  23. SCHEDULER_CRON_MINUTE=0 \
  24. PIPELINE_WORKER_PROCESSES=4 \
  25. PIPELINE_MAX_ACTIVE_STEPS=4 \
  26. MYSQL_CONNECTION_BUDGET=40
  27. 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 || \
  28. 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
  29. RUN apt-get update \
  30. && apt-get install -y --no-install-recommends gcc ffmpeg supervisor \
  31. && ffmpeg -version >/dev/null \
  32. && ffprobe -version >/dev/null \
  33. && ffmpeg -hide_banner -loglevel error \
  34. -f lavfi -i testsrc=duration=2:size=160x120:rate=10 \
  35. -t 2 -c:v libx264 -pix_fmt yuv420p /tmp/verify_src.mp4 \
  36. && ffmpeg -hide_banner -loglevel error -y \
  37. -i /tmp/verify_src.mp4 -t 1 -c copy /tmp/verify_clip.mp4 \
  38. && test -s /tmp/verify_clip.mp4 \
  39. && rm -f /tmp/verify_src.mp4 /tmp/verify_clip.mp4 \
  40. && rm -rf /var/lib/apt/lists/*
  41. COPY pyproject.toml requirements.txt README.md ./
  42. COPY supply_agent/ supply_agent/
  43. COPY supply_infra/ supply_infra/
  44. COPY agents/ agents/
  45. COPY api/ api/
  46. COPY alembic.ini ./
  47. COPY alembic/ alembic/
  48. COPY deploy/ deploy/
  49. COPY scripts/verify_video_truncate_runtime.py scripts/
  50. COPY scripts/container-entrypoint.sh scripts/
  51. RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com ".[odps]" \
  52. && python scripts/verify_video_truncate_runtime.py \
  53. && chmod +x scripts/container-entrypoint.sh
  54. COPY --from=web-builder /app/web/dist ./web/dist
  55. EXPOSE 8080
  56. STOPSIGNAL SIGTERM
  57. ENTRYPOINT ["/app/scripts/container-entrypoint.sh"]