-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
63 lines (56 loc) · 1.42 KB
/
Dockerfile
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
ARG RUST_VERSION=1.58
FROM rust:${RUST_VERSION}-slim-bullseye as planner
RUN apt-get update \
&& apt-get install -y \
libelf-dev \
libgcc-s1 \
libbpf-dev \
bpftool \
clang \
curl \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN cargo install cargo-chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:${RUST_VERSION}-slim-bullseye as cacher
RUN apt-get update \
&& apt-get install -y \
libelf-dev \
libgcc-s1 \
libbpf-dev \
bpftool \
clang \
curl \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:${RUST_VERSION}-slim-bullseye as builder
RUN apt-get update \
&& apt-get install -y \
libelf-dev \
libgcc-s1 \
libbpf-dev \
bpftool \
clang \
curl \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
COPY --from=cacher /app/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
# RUN rustup component add rustfmt
RUN cargo build --release
FROM rust:${RUST_VERSION}-slim-bullseye as runtime
# FROM gcr.io/distroless/cc-debian10 as runtime
COPY --from=builder /app/target/release/sprofiler /
COPY --from=builder /app/target/release/sprofiler-bpf /
ENTRYPOINT ["/sprofiler"]