From: Nutomic Date: Tue, 25 Oct 2022 15:10:07 +0000 (+0000) Subject: Enable lto, strip symbols via cargo.toml (#2512) X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/static/%7Bthis.state.thumbnail%7D?a=commitdiff_plain;h=276a8c2bd3e4fd1323e66b808675cf14cf6f75c5;p=lemmy.git Enable lto, strip symbols via cargo.toml (#2512) --- diff --git a/Cargo.toml b/Cargo.toml index 18cf4eb3..58fb3325 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,13 @@ rust-version = "1.57" [lib] doctest = false +[profile.release] +strip = "symbols" +debug = 0 +lto = "thin" + [profile.dev] +strip = "symbols" debug = 0 [features] diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 13ff6565..14096dc0 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -29,9 +29,6 @@ COPY . . RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs" RUN cargo build --target ${CARGO_BUILD_TARGET} -# reduce binary size -RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server - RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server # The alpine runner diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index 68968007..33a77af8 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -11,9 +11,6 @@ COPY ./ ./ RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs" RUN cargo build --release -# reduce binary size -RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server - RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server # The alpine runner diff --git a/docker/prod/Dockerfile.arm b/docker/prod/Dockerfile.arm index 2076e942..926fa8a7 100644 --- a/docker/prod/Dockerfile.arm +++ b/docker/prod/Dockerfile.arm @@ -15,9 +15,6 @@ RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/ RUN cargo build --release -# reduce binary size -RUN strip ./target/release/lemmy_server - RUN cp ./target/release/lemmy_server /app/lemmy_server # The Debian runner