Skip to content

Commit 2d56886

Browse files
authored
shared/echo: Use prebuilt echo binary (#1044)
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent 568f798 commit 2d56886

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

shared/echo/Dockerfile

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
FROM rust:1.88.0 AS builder
2-
WORKDIR /usr/src/echo
3-
COPY . .
4-
RUN rustup install nightly && rustup default nightly && cargo build --release
5-
6-
7-
FROM debian:bookworm-slim
1+
FROM debian:trixie-slim
2+
ARG BINS_VERSION=0.1.47
3+
ARG ECHO_VERSION=0.1.0
4+
ARG ECHO_SHA256_amd64=da08855d7d5357630aba2da044467773b7e4de806204ea984dc2d11782032885
5+
ARG ECHO_SHA256_arm64=4fe0bbbeeec8b03c3b7bc9d70815153fe5651494c8d63220b33f66d75674ddc9
6+
ARG TARGETARCH
87
RUN --mount=type=tmpfs,target=/var/cache/apt \
98
--mount=type=tmpfs,target=/var/lib/apt/lists \
109
apt-get -qq update \
11-
&& apt-get -qq install -y libssl-dev ca-certificates
12-
COPY --from=builder \
13-
/usr/src/echo/target/release/example-echo \
14-
/usr/local/bin/example-echo
10+
&& apt-get -qq install -y libssl-dev ca-certificates curl \
11+
&& test -n "${TARGETARCH}" || (echo "Error: TARGETARCH build arg must be set" && exit 1) \
12+
&& curl -fsSL "https://github.com/envoyproxy/toolshed/releases/download/bins-v${BINS_VERSION}/echo-${ECHO_VERSION}-${TARGETARCH}" \
13+
-o /usr/local/bin/example-echo \
14+
&& case "${TARGETARCH}" in \
15+
amd64) EXPECTED_SHA="${ECHO_SHA256_amd64}" ;; \
16+
arm64) EXPECTED_SHA="${ECHO_SHA256_arm64}" ;; \
17+
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
18+
esac \
19+
&& echo "${EXPECTED_SHA} /usr/local/bin/example-echo" | sha256sum -c - \
20+
&& chmod +x /usr/local/bin/example-echo
1521
EXPOSE 8080
1622
COPY <<EOF /etc/config.yaml
1723
listeners:

0 commit comments

Comments
 (0)