-
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.
And get caching for docker builds Which should speed things up
- Loading branch information
1 parent
fc04373
commit 5c35c59
Showing
1 changed file
with
16 additions
and
7 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,15 +1,24 @@ | ||
FROM rust:1.82-bookworm as builder | ||
WORKDIR /usr/src/app | ||
FROM lukemathwalker/cargo-chef:latest-rust-1.82 AS chef | ||
WORKDIR /app | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
# Build dependencies - this is the caching Docker layer! | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
# Build application | ||
COPY . . | ||
COPY --from=d3fk/tailwindcss:stable /tailwindcss /usr/local/bin/tailwindcss | ||
ENV SQLX_OFFLINE=true | ||
RUN cargo install --path . | ||
RUN cargo build --release | ||
|
||
# We do not need the Rust toolchain to run the binary! | ||
FROM debian:bookworm-slim | ||
RUN apt-get update && apt-get install -y procps ca-certificates && rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/local/cargo/bin/et-migrate /usr/local/bin/et-migrate | ||
COPY --from=builder /usr/local/cargo/bin/et /usr/local/bin/et | ||
COPY --from=builder /app/target/release/et-migrate /usr/local/bin/et-migrate | ||
COPY --from=builder /app/target/release/et /usr/local/bin/et | ||
|
||
ENTRYPOINT ["/usr/local/bin/et"] |