You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying out prisma-client-rust and I'm currently building a dockerfile.
I'm using Cargo chef to provide a cache layer to avoid compiling dependencies each time and I'm wondering if something similar could be achieved for the command cargo prisma build.
This command should generate the same file if the schema doesn't change (I guess) but it looks like docker is running this command anyway
Does someone encounter this problem and found a solution/workaround?
The text was updated successfully, but these errors were encountered:
Here's an example Dockerfile that does it, the trick was to create a empty project with the workspace entry in the cargo.toml:
# Leveraging the pre-built Docker images with
# cargo-chef and the Rust toolchain
FROM lukemathwalker/cargo-chef:latest-rust-1.77.0 AS chef
WORKDIR /app
FROM chef AS prisma-cli
# Build prisma cli
COPY ./prisma-cli ./prisma-cli
RUN cargo init
RUN echo "[workspace]\nmembers = [\"prisma-cli\"]" > Cargo.toml
RUN cargo build --manifest-path prisma-cli/Cargo.toml
FROM prisma-cli as prisma-client-1
COPY prisma/schema.prisma prisma/schema.prisma
COPY .cargo .cargo
RUN cargo prisma generate --schema prisma/schema.prisma
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
COPY --from=prisma-client-1 /app/src/prisma.rs src/prisma.rs
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release
FROM gcr.io/distroless/cc as runtime
COPY --from=builder /app/target/release/app /usr/local/bin/app
STOPSIGNAL SIGINT
ENTRYPOINT ["./usr/local/bin/app"]
Trying out prisma-client-rust and I'm currently building a dockerfile.
I'm using Cargo chef to provide a cache layer to avoid compiling dependencies each time and I'm wondering if something similar could be achieved for the command
cargo prisma build
.This command should generate the same file if the schema doesn't change (I guess) but it looks like docker is running this command anyway
Does someone encounter this problem and found a solution/workaround?
The text was updated successfully, but these errors were encountered: