FROM docker.io/rust:1.51-alpine as build WORKDIR /app RUN apk add \ cmake \ musl-dev \ make \ g++ \ && rustup target add x86_64-unknown-linux-musl COPY Cargo.lock Cargo.toml . COPY crieur-chatbot crieur-chatbot COPY crieur-retrieve crieur-retrieve COPY src src RUN RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --target x86_64-unknown-linux-musl --release --bin=crieur-chatbot FROM scratch WORKDIR / COPY --from=build /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6 COPY --from=build /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1 COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 COPY --from=build /app/target/x86_64-unknown-linux-musl/release/crieur-chatbot /crieur-chatbot CMD ["./crieur-chatbot"]