-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (39 loc) · 1.52 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
FROM --platform=linux/amd64 rust:slim AS build
COPY ./rust-toolchain.toml ./rust-toolchain.toml
RUN apt-get update \
&& apt-get install build-essential libssl-dev pkg-config libprotobuf-dev protobuf-compiler gcc-aarch64-linux-gnu libc6-dev-arm64-cross -y \
&& rustup update \
&& rustup target add aarch64-unknown-linux-gnu \
&& mkdir build
WORKDIR build
ARG features=all-databases,otlp,caching-skytable
RUN USER=root cargo init --bin --name feedback-fusion
RUN USER=root cargo init --lib --name feedback_fusion_common common
RUN USER=root cargo init --lib --name feedback_fusion_codegen codegen
COPY ./.cargo ./.cargo
COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./proto ./proto
COPY ./common ./common
COPY ./codegen ./codegen
COPY ./fuzz ./fuzz
COPY ./benches ./benches
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
cargo build --release --target aarch64-unknown-linux-gnu --features $features; \
else \
cargo build --release --features $features; \
fi
RUN rm -Rf ./src
COPY ./src ./src
# for some reason cargo does not detect the file change
RUN touch src/main.rs
RUN if [ "$TARGETARCH" = "arm64" ]; then \
cargo build --release --target aarch64-unknown-linux-gnu --features $features; \
mv target/aarch64-unknown-linux-gnu/release/feedback-fusion target/release/feedback-fusion; \
else \
cargo build --release --features $features; \
fi
FROM gcr.io/distroless/cc-debian12
COPY --from=build ./build/target/release/feedback-fusion .
ENTRYPOINT ["./feedback-fusion"]