Current release profile come with debug info and lto=fat, which is quite unnecessary for release build.
this cause cargo build --release generated 60M+ binary file, and is not ideal for docker image or small footprint devices.
[profile.release]
debug = 1
opt-level = 3
lto = "fat"
result:
root@debian-dev:~/torrust-tracker# ls -lah target/release/torrust-tracker
-rwxr-xr-x 2 root root 64M May 1 23:55 target/release/torrust-tracker
root@debian-dev:~/torrust-tracker# file target/release/torrust-tracker
target/release/torrust-tracker: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=somebuild-sha1-hash, for GNU/Linux 3.2.0, with debug_info, not stripped
when change the release profile to
[profile.release]
strip = true
opt-level = 3
lto = true
codegen-units = 1
panic = "abort"
result:
root@debian-dev:~/torrust-tracker# ls -lah target/release/torrust-tracker
-rwxr-xr-x 2 root root 11M May 1 23:58 target/release/torrust-tracker
root@debian-dev:~/torrust-tracker# file target/release/torrust-tracker
target/release/torrust-tracker: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=somebuild-sha1-hash, for GNU/Linux 3.2.0, stripped
The details are in link
Current release profile come with debug info and lto=fat, which is quite unnecessary for release build.
this cause
cargo build --releasegenerated 60M+ binary file, and is not ideal for docker image or small footprint devices.result:
when change the release profile to
result:
The details are in link