diff --git a/Cargo.toml b/Cargo.toml index 8ec2a12..1393479 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,12 +12,13 @@ default-members = [ "src/app", ] -[profile.release] +[profile.dist] +inherits = "release" opt-level = "z" # Optimize for minimum binary size -lto = "fat" # Enable Link-Time Optimization (removes dead code across crate boundaries) -codegen-units = 1 # Maximize optimization at the cost of slower compile times -strip = true # Strip debug symbols and DWARF tables from the final binary -panic = "abort" # Remove unwinding code to reduce binary size +lto = "fat" # Enable aggressive Fat LTO for production builds +codegen-units = 1 # Maximize optimization for production +strip = true # Strip debug symbols +panic = "abort" # Remove unwinding code to further reduce size [workspace.package] authors = ["omnect@conplement.de"] diff --git a/Dockerfile b/Dockerfile index 38ee4fb..2cec766 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,8 +87,8 @@ COPY --from=vue-build /usr/src/app/dist ./src/ui/dist # Cache mounts persist compiled dependencies across builds RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry-${TARGETARCH} \ --mount=type=cache,target=/work/build,id=cargo-build-${TARGETARCH} \ - cargo auditable build ${OMNECT_UI_BUILD_ARG} --release -p omnect-ui --target-dir ./build && \ - cp ./build/release/omnect-ui /work/omnect-ui-bin + cargo auditable build ${OMNECT_UI_BUILD_ARG} --profile dist -p omnect-ui --target-dir ./build && \ + cp ./build/dist/omnect-ui /work/omnect-ui-bin SHELL ["/bin/bash", "-c"] RUN <