/ a2a / Dockerfile
Dockerfile
 1  ##### Base image
 2  FROM python:3.13-slim AS base
 3  
 4  ENV PYTHONUNBUFFERED=1
 5  ENV UV_PROJECT_ENVIRONMENT=/app/.venv
 6  ENV PATH="/app/.venv/bin:$PATH"
 7  RUN pip install uv
 8  
 9  WORKDIR /app
10  COPY pyproject.toml uv.lock ./
11  RUN --mount=type=cache,target=/root/.cache/uv \
12      UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy \
13      uv sync --locked --no-dev --no-install-project
14  COPY main.py src ./
15  RUN python -m compileall -q .
16  
17  ENV AGENT_CONFIG=/app/agent.yaml
18  
19  COPY <<EOF ./entrypoint.sh
20  #!/bin/sh
21  set -e
22  
23  if test -f /run/secrets/openai-api-key; then
24      export OPENAI_API_KEY=$(cat /run/secrets/openai-api-key)
25  fi
26  
27  if test -n "\${OPENAI_API_KEY}"; then
28      echo "Using OpenAI with \${OPENAI_MODEL_NAME}"
29      export LLM_AGENT_MODEL_PROVIDER=openai
30      export LLM_AGENT_MODEL_NAME=\${OPENAI_MODEL_NAME}
31  else
32      echo "Using Docker Model Runner with \${MODEL_RUNNER_MODEL}"
33      export LLM_AGENT_MODEL_PROVIDER=docker
34      export LLM_AGENT_MODEL_NAME=\${MODEL_RUNNER_MODEL}
35  fi
36  exec \$@
37  EOF
38  RUN chmod +x ./entrypoint.sh
39  
40  RUN useradd --create-home --shell /bin/bash app \
41      && chown -R app:app /app
42  USER app
43  
44  ##### Critic Agent
45  FROM base AS critic-agent
46  
47  COPY --chown=app:app agents/critic.yaml /app/agent.yaml
48  CMD ["./entrypoint.sh", "python", "main.py", "--host", "0.0.0.0", "--port", "8001"]
49  
50  ##### Reviser Agent
51  FROM base AS reviser-agent
52  
53  COPY --chown=app:app agents/reviser.yaml /app/agent.yaml
54  CMD ["./entrypoint.sh", "python", "main.py", "--host", "0.0.0.0", "--port", "8001"]
55  
56  ##### Auditor Agent
57  FROM base AS auditor-agent
58  
59  COPY --chown=app:app agents/auditor.yaml /app/agent.yaml
60  EXPOSE 8080
61  CMD ["./entrypoint.sh", "adk", "web", ".", "--host", "0.0.0.0", "--port", "8080"]
62  # Use this to expose the agent as a web service instead of a UI
63  #CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8002"]