cargo-tarpaulin 0.21.0

Cargo-Tarpaulin is a tool to determine code coverage achieved via tests
Documentation
FROM rustlang/rust:nightly as builder

WORKDIR /opt/tarpaulin

RUN env USER=root cargo init .

COPY Cargo.toml .
COPY Cargo.lock .
COPY build.rs .

RUN mkdir .cargo
RUN cargo vendor > .cargo/config

COPY src /opt/tarpaulin/src

RUN cd /opt/tarpaulin/ && \
    cargo install --locked --path . && \
    rm -rf /opt/tarpaulin/ && \
    rm -rf /usr/local/cargo/registry/

FROM rustlang/rust:nightly-slim

RUN apt-get update && \
    apt-get install -y curl && \
    rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/local/cargo/bin/cargo-tarpaulin /usr/local/cargo/bin/cargo-tarpaulin

WORKDIR /volume

CMD cargo build && cargo tarpaulin