1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-07-18 02:20:12 +02:00
programming-challenges/templates/docker/rust/Dockerfile

17 lines
477 B
Docker

FROM rust:1.70.0 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-debian11:latest AS runner
WORKDIR /usr/src/rust_application
COPY --from=builder /usr/src/rust_application/target/release/rust_application ./
CMD ["./rust_application"]