-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use clients and service from jarvis_lib; use cargo chef for faster bu…
…ilds
- Loading branch information
1 parent
bcda852
commit 5840c84
Showing
13 changed files
with
104 additions
and
769 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.git | ||
helm | ||
target | ||
|
||
.dockerignore | ||
.estafette.yaml | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 +1,32 @@ | ||
# Step 1: Build the application | ||
FROM rust:1.52 as builder | ||
|
||
WORKDIR app | ||
# from https://www.lpalmieri.com/posts/fast-rust-docker-builds/ | ||
FROM rust:1.52 as planner | ||
WORKDIR /app | ||
RUN apt-get update && apt-get install -y --no-install-recommends musl-tools | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
RUN cargo install cargo-chef --version 0.1.20 | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
# RUN apk add --update musl-dev | ||
FROM rust:1.52 as cacher | ||
WORKDIR /app | ||
RUN apt-get update && apt-get install -y --no-install-recommends musl-tools | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
RUN cargo install cargo-chef --version 0.1.20 | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json | ||
|
||
FROM rust:1.52 as builder | ||
RUN apt-get update && apt-get install -y --no-install-recommends musl-tools | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=cacher /app/target target | ||
COPY --from=cacher /usr/local/cargo /usr/local/cargo | ||
RUN cargo test --release --target x86_64-unknown-linux-musl | ||
RUN ls -latr /app/target/x86_64-unknown-linux-musl/release/ | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
RUN ls -latr /app/target/x86_64-unknown-linux-musl/release/ | ||
|
||
# Step 2: Create the runtime container image | ||
FROM scratch AS runtime | ||
|
||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/jarvis-alpha-innotec-exporter . | ||
USER 1000 | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/jarvis-alpha-innotec-exporter . | ||
ENTRYPOINT ["./jarvis-alpha-innotec-exporter"] |
Oops, something went wrong.