-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile checks for cargo clippy and cargo fmt
- Loading branch information
1 parent
c815d30
commit 168c2f1
Showing
5 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
# Use an official Rust runtime as a parent image | ||
FROM rust:latest | ||
|
||
# Set the working directory in the container | ||
WORKDIR /usr/src/myapp | ||
|
||
# Copy the current directory contents into the container at /usr/src/myapp | ||
# Stage 1: Build Environment | ||
FROM rust:latest AS base | ||
WORKDIR /usr/src/tinty | ||
COPY . . | ||
|
||
# Compile the application | ||
RUN cargo build --release | ||
|
||
ENV RUST_TEST_THREADS=1 | ||
# Stage 2: Run cargo clippy | ||
FROM base AS clippy | ||
RUN rustup component add clippy && \ | ||
cargo clippy -- -D warnings | ||
|
||
# Stage 3: Run cargo fmt | ||
FROM base as fmt | ||
RUN rustup component add rustfmt && \ | ||
cargo fmt --all -- --check | ||
|
||
# Run tests | ||
CMD ["cargo", "test"] | ||
# Stage 4: Run tests | ||
FROM base as test | ||
ENV RUST_TEST_THREADS=1 | ||
RUN cargo test --release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters