-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.test
28 lines (23 loc) · 1004 Bytes
/
Dockerfile.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Rust-based image with cargo-tarpaulin pre-installed
FROM xd009642/tarpaulin
# This build-arg will be used by cargo-tarpaulin to upload code coverage reports to coveralls
ARG REPO_TOKEN
# Perform apt actions as root
RUN apt install libssl-dev
# Create build directory as root
WORKDIR /usr/src
RUN USER=root cargo new service
# Perform an initial compilation to cache dependencies
WORKDIR /usr/src/service
COPY Cargo.lock Cargo.toml ./
RUN echo "fn main() {println!(\"if you see this, the image build failed and kept the depency-caching entrypoint. check your dockerfile and image build logs.\")}" > src/main.rs
RUN cargo tarpaulin --locked
# Load source code to create final binary
RUN rm -rf src
# If the bust file exists, it will be added
# If it's filled with a random value, the testing and code coverage
# cache will be broken
COPY src bust* ./src/
# Copy the fit folder so code cov knows which branch we're on
COPY .git .git
RUN cargo tarpaulin --locked --skip-clean --coveralls $REPO_TOKEN