This image downloads and install bazel on top of a compatible environment for C++ distroless projects.
You can have this multiple stage Dockerfile on the root directory of your project.
FROM carlosdias/cpp-bazel-distroless:1.0 as builder
RUN bazel --output_user_root=output build --compilation_mode=opt :target
FROM gcr.io/distroless/cc
COPY --from=builder /app/bazel-bin/target /app/target
CMD ["/app/target"]
More details and versions in carlosdias/cpp-bazel-distroless