-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
36 lines (27 loc) · 1.01 KB
/
Dockerfile
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
29
30
31
32
33
34
35
36
# Docker image for the Mango front-end library.
# The purpose of this image is not distribution; the CLI package contains the distributable image.
# This image is mostly to run tests in a reproducible environment.
FROM ekidd/rust-musl-builder:nightly-2020-11-19 AS build
ENV RUST_BACKTRACE=1
ENV CARGO_HOME=/home/rust/.cargo
ENV RUSTUP_HOME=/home/rust/.rustup
USER root
RUN rustup component add rustfmt
RUN rustup component add clippy
WORKDIR /mango
# Build the dependencies (for image caching)
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir src && \
printf '// placeholder for compiling dependencies' > src/lib.rs
RUN cargo build --release
# Now add the actual code
COPY src src
# This makes sure things are rebuilt
RUN touch src/lib.rs
# Test the code, including style checks
RUN cargo --offline fmt --all
RUN cargo --offline clippy --release --all-targets --all-features -- -D warnings
RUN cargo --offline test --release --all-targets --all-features --all
# Build the code
RUN cargo --offline build --lib --release