-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
22 lines (21 loc) · 898 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM --platform=$BUILDPLATFORM ghcr.io/linkerd/dev:v43-rust-musl as builder
ARG BUILD_TYPE="release"
WORKDIR /build
RUN mkdir -p target/bin
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo fetch
ARG TARGETARCH
RUN --mount=type=cache,target=target \
--mount=type=cache,target=/usr/local/cargo/registry \
target=$(case "$TARGETARCH" in \
amd64) echo x86_64-unknown-linux-musl ;; \
arm64) echo aarch64-unknown-linux-musl ;; \
arm) echo armv7-unknown-linux-musleabihf ;; \
*) echo "unsupported architecture: $TARGETARCH" >&2; exit 1 ;; \
esac) && \
just-cargo profile=$BUILD_TYPE target=$target build --package=linkerd-extension-init && \
mv "target/$target/$BUILD_TYPE/linkerd-extension-init" /tmp/
FROM scratch as runtime
COPY --from=builder /tmp/linkerd-extension-init /bin/
ENTRYPOINT ["/bin/linkerd-extension-init"]