forked from agentgateway/agentgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
95 lines (73 loc) · 2.63 KB
/
Dockerfile
File metadata and controls
95 lines (73 loc) · 2.63 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# syntax=docker/dockerfile:1.11
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.93.0-trixie 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.93.0-trixie 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
ARG VERSION
ARG GIT_REVISION
WORKDIR /app
COPY Makefile Cargo.toml Cargo.lock ./
COPY .cargo ./.cargo
COPY crates ./crates
COPY tools ./tools
COPY --from=node /app/out ./ui/out
RUN \
--mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
cargo fetch --locked
RUN --mount=type=cache,target=/app/target \
--mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
<<EOF
export VERSION="${VERSION}"
export GIT_REVISION="${GIT_REVISION}"
cargo build --features ui --target "$(cat /build/target)" --profile ${PROFILE} || exit 1
mkdir /out
mv /app/target/$(cat /build/target)/${PROFILE}/agentgateway /out
/out/agentgateway --version
# Fail if version is not set
if /out/agentgateway --version | grep -q '"unknown"'; then
exit 1
fi
EOF
FROM cgr.dev/chainguard/glibc-dynamic 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"]