Dockerfile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # syntax=docker/dockerfile:1
  2. FROM node:22-bookworm-slim AS frontend
  3. WORKDIR /build/frontend
  4. COPY frontend/package.json frontend/package-lock.json ./
  5. RUN npm ci
  6. COPY frontend/ ./
  7. RUN npm run build
  8. FROM python:3.12-slim-bookworm AS runtime
  9. ENV PYTHONUNBUFFERED=1 \
  10. PYTHONDONTWRITEBYTECODE=1 \
  11. LANG=C.UTF-8 \
  12. TZ=Asia/Shanghai \
  13. DEEP_AGENT_ENV_PRIORITY=process \
  14. HOST=0.0.0.0 \
  15. PORT=8080 \
  16. LOG_LEVEL=INFO \
  17. LOG_FORMAT=json \
  18. LOG_FILE=/app/logs/ventagent.jsonl \
  19. TIKTOKEN_CACHE_DIR=/usr/local/share/tiktoken \
  20. MAIN_FAN_REPORT_MODE=crawler \
  21. MAIN_FAN_REPORT_API_URL=http://10.244.3.155:19010 \
  22. MAIN_FAN_REPORT_SOURCE_DIR=/data/source_data \
  23. RESULT_PLATFORM_ENABLED=False \
  24. MAIN_FAN_WORKFLOW_PUBLISH_ENABLED=False
  25. # 工作流默认本地核验;未来上报须同时开启总开关与 MAIN_FAN_WORKFLOW_PUBLISH_ENABLED。
  26. # URL、token、模型配置在运行时通过 --env-file 注入,不写入镜像。
  27. WORKDIR /app
  28. RUN apt-get update \
  29. && apt-get install -y --no-install-recommends bubblewrap ca-certificates tzdata \
  30. fonts-noto-cjk fontconfig libglib2.0-0 libgomp1 \
  31. && rm -rf /var/lib/apt/lists/*
  32. COPY release/requirements.lock /tmp/requirements.lock
  33. RUN pip install --no-cache-dir --require-hashes -r /tmp/requirements.lock \
  34. && rm /tmp/requirements.lock
  35. # 联网构建时保存分词词表;离线运行时无需首次下载。
  36. RUN python -c "import tiktoken; [tiktoken.get_encoding(name) for name in ('cl100k_base', 'o200k_base')]"
  37. RUN groupadd --gid 10001 ventagent \
  38. && useradd --uid 10001 --gid ventagent --create-home ventagent
  39. COPY --chown=ventagent:ventagent . /app
  40. COPY --from=frontend --chown=ventagent:ventagent /build/static/ /app/static/
  41. RUN mkdir -p /app/data /app/outputs /app/logs \
  42. && chown -R ventagent:ventagent /app/data /app/outputs /app/logs
  43. ENV BILLING_ENABLED=False \
  44. DEEPAGENT_THINKING=highest \
  45. OPENAI_TOOL_CALL_STREAMING=False
  46. USER ventagent
  47. EXPOSE 8080
  48. STOPSIGNAL SIGTERM
  49. HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
  50. CMD python -c "import json,os,urllib.request; r=json.load(urllib.request.urlopen('http://127.0.0.1:'+os.getenv('PORT','8080')+'/health',timeout=3)); raise SystemExit(r.get('status') != 'ok')"
  51. CMD ["python", "main.py"]