You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
464 B

FROM rust AS builder
WORKDIR /random
# Build dependencies
RUN echo "fn main() {}" > dummy.rs
COPY Cargo.toml .
RUN sed -i 's#src/main.rs#dummy.rs#' Cargo.toml
RUN cargo build --release
RUN sed -i 's#dummy.rs#src/main.rs#' Cargo.toml
# Prepare build
COPY src src
RUN touch src/main.rs
# Build release
RUN cargo build --release
# Run binary
FROM rust:slim
WORKDIR /app
COPY --from=builder /random/target/release/random random
COPY static static
CMD ["./random"]