# This Dockerfile is mostly for CI, see .github/workflows/tests.yml
# Base image has the latest "nightly" build along with rustfmt & clippy
FROM rustlang/rust:nightly AS rocket-sentry-build
WORKDIR /root/build
# Make warnings fatal
ENV RUSTFLAGS="-D warnings"
RUN rustup component add rustfmt clippy
# Build Cargo dependencies for cache
COPY Cargo.toml ./
RUN mkdir src/ && \
echo "pub fn main() {println!(\"dummy function\")}" > src/lib.rs && \
cargo build --lib --tests --examples --color=always && \
rm -rdv target/*/deps/rocket_sentry-* \
target/*/.fingerprint/rocket-sentry-*
# Do the actual build
COPY . .
RUN cargo build --lib --tests --examples --color=always