45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
ARG RUST_IMAGE=rust:1.42.0-buster
|
|
ARG RUNTIME_IMAGE=debian:bullseye-slim
|
|
ARG RUSTFLAGS="-C debuginfo=2 -C lto=off"
|
|
## Builds the proxy as incrementally as possible.
|
|
FROM $RUST_IMAGE as build
|
|
|
|
RUN cargo install inferno
|
|
|
|
WORKDIR /usr/src/linkerd2-proxy
|
|
|
|
COPY . .
|
|
|
|
RUN cargo fetch --locked
|
|
RUN RUSTFLAGS=$RUSTFLAGS cargo build \
|
|
--frozen --release \
|
|
-p linkerd2-app-profiling \
|
|
--bin profile && \
|
|
mv target/release/profile target/linkerd2-proxy
|
|
|
|
## Install the proxy binary into the base runtime image.
|
|
FROM $RUNTIME_IMAGE as runtime
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y linux-perf linux-base netcat curl iproute2 openssh-client && \
|
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/ && \
|
|
mv /usr/bin/perf_* /usr/bin/perf
|
|
|
|
RUN curl -L -O \
|
|
https://github.com/nokia/memory-profiler/releases/download/0.3.0/memory-profiler-x86_64-unknown-linux-gnu.tgz && \
|
|
tar xf memory-profiler-x86_64-unknown-linux-gnu.tgz && \
|
|
rm memory-profiler-x86_64-unknown-linux-gnu.tgz && \
|
|
mv memory-profiler-cli /usr/bin/memory-profiler-cli && \
|
|
mv libmemory_profiler.so /usr/lib/libmemory_profiler.so
|
|
|
|
WORKDIR /linkerd
|
|
|
|
COPY --from=build /usr/local/cargo/bin/inferno-collapse-perf /usr/bin/inferno-collapse-perf
|
|
COPY --from=build /usr/local/cargo/bin/inferno-flamegraph /usr/bin/inferno-flamegraph
|
|
COPY --from=build /usr/src/linkerd2-proxy/target/linkerd2-proxy /usr/lib/linkerd/linkerd2-proxy
|
|
COPY ./profiling/run-proxy.sh /usr/bin/run-proxy
|
|
|
|
ENV PATH="/usr/bin/:${PATH}"
|
|
|
|
ENTRYPOINT ["/usr/bin/run-proxy"]
|