2023-10-23 23:16:24 +02:00
|
|
|
FROM rust:1.73.0 AS builder
|
2022-12-30 00:55:21 +01:00
|
|
|
WORKDIR /usr/src/rust_application
|
2022-04-23 18:41:14 +02:00
|
|
|
|
2022-12-30 00:55:21 +01:00
|
|
|
# Cache dependencies
|
|
|
|
RUN cargo init --bin ./
|
|
|
|
COPY ./Cargo.* ./
|
|
|
|
RUN cargo build --release && rm --recursive --force ./src ./target/release/deps/rust_application*
|
2022-04-23 18:41:14 +02:00
|
|
|
|
2022-12-30 00:55:21 +01:00
|
|
|
# Build application
|
|
|
|
COPY ./ ./
|
|
|
|
RUN cargo build --release
|
|
|
|
|
2023-09-16 14:38:47 +02:00
|
|
|
FROM gcr.io/distroless/cc-debian12:latest AS runner
|
2022-12-30 00:55:21 +01:00
|
|
|
WORKDIR /usr/src/rust_application
|
|
|
|
COPY --from=builder /usr/src/rust_application/target/release/rust_application ./
|
|
|
|
CMD ["./rust_application"]
|