forked from agentgateway/agentgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
79 lines (57 loc) · 2.23 KB
/
Dockerfile
File metadata and controls
79 lines (57 loc) · 2.23 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
ARG BUILDER=base
FROM docker.io/library/node:23.11.0-bookworm AS node
WORKDIR /app
COPY ui .
RUN --mount=type=cache,target=/app/npm/cache npm install
RUN --mount=type=cache,target=/app/npm/cache npm run build
FROM docker.io/library/rust:1.89.0-slim-bookworm AS musl-builder
ARG TARGETARCH
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
apt-get update && apt-get install -y --no-install-recommends \
make musl-tools
RUN <<EOF
mkdir /build
if [ "$TARGETARCH" = "arm64" ]; then
rustup target add aarch64-unknown-linux-musl;
echo aarch64-unknown-linux-musl > /build/target
else
rustup target add x86_64-unknown-linux-musl;
echo x86_64-unknown-linux-musl > /build/target
fi
EOF
FROM docker.io/library/rust:1.89.0-slim-bookworm AS base-builder
ARG TARGETARCH
RUN <<EOF
mkdir /build
if [ "$TARGETARCH" = "arm64" ]; then
echo aarch64-unknown-linux-gnu > /build/target
else
echo x86_64-unknown-linux-gnu > /build/target
fi
echo "Building $(cat /build/target)"
EOF
FROM ${BUILDER}-builder AS builder
ARG TARGETARCH
ARG PROFILE=release
WORKDIR /app
COPY Makefile Cargo.toml Cargo.lock ./
COPY crates ./crates
COPY common ./common
COPY --from=node /app/out ./ui/out
RUN --mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
cargo fetch --locked
RUN --mount=type=cache,target=/app/target \
--mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
cargo build --features ui --target "$(cat /build/target)" --profile ${PROFILE} && \
mkdir /out && \
mv /app/target/$(cat /build/target)/${PROFILE}/agentgateway /out
FROM gcr.io/distroless/cc-debian12 AS runner
ARG TARGETARCH
WORKDIR /
COPY --from=builder /out/agentgateway /app/agentgateway
LABEL org.opencontainers.image.source=https://github.com/agentgateway/agentgateway
LABEL org.opencontainers.image.description="Agentgateway is an open source project that is built on AI-native protocols to connect, secure, and observe agent-to-agent and agent-to-tool communication across any agent framework and environment."
ENTRYPOINT ["/app/agentgateway"]