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

4 months ago
4 months ago
  1. FROM rust AS builder
  2. WORKDIR /random
  3. # Build dependencies
  4. RUN echo "fn main() {}" > dummy.rs
  5. COPY Cargo.toml .
  6. RUN sed -i 's#src/main.rs#dummy.rs#' Cargo.toml
  7. RUN cargo build --release
  8. RUN sed -i 's#dummy.rs#src/main.rs#' Cargo.toml
  9. # Prepare build
  10. COPY src src
  11. RUN touch src/main.rs
  12. # Build release
  13. RUN cargo build --release
  14. # Run binary
  15. FROM rust:slim
  16. WORKDIR /app
  17. COPY --from=builder /random/target/release/random random
  18. COPY static static
  19. CMD ["./random"]