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
Raw Normal View History

2023-12-26 23:05:18 +01:00
FROM rust:1.74.1 AS builder
2022-12-30 00:55:21 +01:00
WORKDIR /usr/src/rust_application
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-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"]