graphql-engine/v3/debug.Dockerfile
Samir Talwar 29408c7854 Fix the benchmarks. (#494)
The benchmarks were not working because they couldn't access Git
information. While this is fair, they didn't actually fail, they kept
going, so I have improved the script to fail hard, and fixed the bug by
setting `RELEASE_VERSION` so the build script doesn't bother trying to
read Git.

V3_GIT_ORIGIN_REV_ID: 9573ea32371d7a4d7b99c87017a8d5d77815832c
2024-04-23 09:20:18 +00:00

41 lines
1.2 KiB
Docker

FROM rust:1.77.0
WORKDIR app
ENV DEBIAN_FRONTEND=noninteractive
RUN set -ex;\
apt-get update; \
apt-get install --no-install-recommends --assume-yes \
curl git jq pkg-config ssh \
libssl-dev lld protobuf-compiler
# Set up a directory to store Cargo files.
ENV CARGO_HOME=/app/.cargo
ENV PATH="$PATH:$CARGO_HOME/bin"
# Switch to `lld` as the linker.
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld"
# Building with build.rs requires the Git context to be available across volumes.
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
# Install Rust tools.
RUN cargo install cargo-chef cargo-nextest critcmp grcov just
COPY rust-toolchain.toml .
RUN rustup show
COPY Cargo.toml Cargo.lock .
RUN mkdir bin
# Build the binaries and tests
RUN --mount=type=cache,target=/app/.cargo/git --mount=type=cache,target=/app/.cargo/registry \
--mount=type=cache,target=./target \
--mount=type=bind,source=./crates,target=./crates \
set -ex; \
cargo build --all-targets; \
cargo nextest archive --archive-file=./bin/nextest.tar.zst
# Copy the binaries out of the cache
RUN --mount=type=cache,target=./target \
find target/debug -maxdepth 1 -type f -executable -exec cp '{}' bin \;