1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00
programming-challenges/templates/docker/rust/Dockerfile

17 lines
477 B
Docker

FROM rust:1.74.1 AS builder
WORKDIR /usr/src/rust_application
# Cache dependencies
RUN cargo init --bin ./
COPY ./Cargo.* ./
RUN cargo build --release && rm --recursive --force ./src ./target/release/deps/rust_application*
# Build application
COPY ./ ./
RUN cargo build --release
FROM gcr.io/distroless/cc-debian12:latest AS runner
WORKDIR /usr/src/rust_application
COPY --from=builder /usr/src/rust_application/target/release/rust_application ./
CMD ["./rust_application"]