Skip to content

Commit

Permalink
Switch to using base CI image
Browse files Browse the repository at this point in the history
  • Loading branch information
mverleg committed May 2, 2021
1 parent 2131017 commit d7b6597
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions ci/simple.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@

FROM clux/muslrust:nightly-2021-04-24 AS build

ENV RUST_BACKTRACE=1

RUN rustup component add rustfmt
RUN rustup component add clippy
RUN cargo install cargo-outdated
RUN cargo install cargo-audit
RUN cargo install cargo-deny
RUN cargo install cargo-tree

# Add the files needed to compile dependencies.
COPY ./Cargo.toml Cargo.lock ./
RUN mkdir -p src common/src daemon/src cli/src && \
printf '\nfn main() {\n\tprintln!("placeholder for compiling dependencies")\n}\n' | tee common/src/lib.rs | tee daemon/src/main.rs | tee cli/src/main.rs
COPY common/Cargo.toml ./common/
COPY daemon/Cargo.toml ./daemon/
COPY cli/Cargo.toml ./cli/

# Build the dependencies, remove Cargo files so they have to be re-added.
RUN cargo build --workspace --tests &&\
cargo build --workspace --release &&\
rm -rf Cargo.toml Cargo.lock common/ daemon/ cli/
#TODO @mark: why compile still takes >1 min each despite pre-compiled dependencies?
FROM mangocode/mango_daily_base:2021-05-02 AS build

# Copy the actual code.
COPY ./Cargo.toml ./Cargo.lock ./deny.toml ./rustfmt.toml ./
Expand All @@ -32,7 +11,7 @@ COPY ./cli/ ./cli
# Build (for test)
RUN find . -name target -prune -o -type f &&\
touch -c common/src/lib.rs daemon/src/main.rs cli/src/main.rs &&\
cargo --offline build --workspace --tests
cargo build --workspace --tests

# Test
RUN cargo --offline test --workspace --all-targets --all-features
Expand Down

0 comments on commit d7b6597

Please sign in to comment.