-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathDockerfile.sam-sdk-python
More file actions
26 lines (24 loc) · 1.42 KB
/
Copy pathDockerfile.sam-sdk-python
File metadata and controls
26 lines (24 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# The Python SDK with its example programs, as the testnet canaries run them:
# `python examples/agent.py [url]` joins as an agent that accepts A2A
# requests, `python examples/call.py [peer] <service> <tool|path> [args]`
# calls a service or an agent, and `examples/a2a_agent.py` and
# `examples/a2a_call.py` do the same with the official A2A SDK, which the
# `examples` extra installs. fastecdsa, a py-libp2p dependency, builds from
# source against GMP, so the build stage carries a compiler and the final
# image only libgmp10.
# Stage 1: Build
FROM python:3.12-slim-bookworm@sha256:392307d22300de8b5986851a12d9176dfc0fc073e65bf6523ebd7dcbeb23564e AS builder
RUN apt-get update && apt-get install -y --no-install-recommends gcc libgmp-dev python3-dev && rm -rf /var/lib/apt/lists/*
COPY sdk/python /src
RUN python -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir '/src[examples]'
# Stage 2: Final
FROM python:3.12-slim-bookworm@sha256:392307d22300de8b5986851a12d9176dfc0fc073e65bf6523ebd7dcbeb23564e
RUN apt-get update && apt-get install -y --no-install-recommends libgmp10 && rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 65532 nonroot && useradd --uid 65532 --gid nonroot --create-home nonroot
WORKDIR /app
COPY --from=builder --chown=nonroot:nonroot /opt/venv /opt/venv
COPY --chown=nonroot:nonroot sdk/python/examples ./examples
USER nonroot:nonroot
ENV PATH=/opt/venv/bin:$PATH
ENTRYPOINT ["python"]
CMD ["examples/agent.py"]