mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-11-09 22:08:58 +01:00
17 lines
477 B
Docker
17 lines
477 B
Docker
FROM rust:1.72.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-debian12:latest AS runner
|
|
WORKDIR /usr/src/rust_application
|
|
COPY --from=builder /usr/src/rust_application/target/release/rust_application ./
|
|
CMD ["./rust_application"]
|