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.
 
 
 
 
 

20 lines
510 B

FROM rust:1-bullseye as builder
WORKDIR /usr/src/
RUN cargo new myapp --vcs none
WORKDIR /usr/src/myapp
COPY Cargo.toml ./
COPY rust-toolchain ./
RUN cargo build --release
# 为了充分利用docker的缓存
COPY src ./src
COPY migrations ./migrations
RUN touch src/main.rs && cargo build --release
FROM debian:bullseye-slim
RUN apt-get update && apt-get install libpq5 -y
COPY --from=builder /usr/src/myapp/target/release/hole-thu /usr/local/bin/hole-thu
COPY Rocket.toml /usr/local/bin/
CMD ["hole-thu"]