diff --git a/Cargo.toml b/Cargo.toml index f7f6b07..a5b1fd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,9 @@ parse_duration = "2.1.1" serde = "1.0.210" tokio = {version = "1.40.0", features = ["full"]} tokio-macros = "2.4.0" + +[profile.release] +opt-level = 3 +debug = false +lto = true +strip = true diff --git a/Dockerfile b/Dockerfile index a85f102..773e06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,13 @@ FROM chef AS planner COPY . . RUN cargo chef prepare --recipe-path recipe.json -FROM chef AS builder +FROM chef AS builder COPY --from=planner /app/recipe.json recipe.json -RUN cargo chef cook --recipe-path recipe.json +RUN cargo chef cook --release --recipe-path recipe.json COPY . . -RUN cargo build +RUN cargo build --release FROM debian:12-slim AS runtime WORKDIR /app -COPY --from=builder /app/target/debug/doctor-restart /usr/local/bin -ENTRYPOINT ["/usr/local/bin/doctor-restart"] \ No newline at end of file +COPY --from=builder /app/target/release/doctor-restart /usr/local/bin +ENTRYPOINT ["/usr/local/bin/doctor-restart"]