From 84ac857c937137a09bcb63ce23b4eb9354f546bb Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 22 Sep 2025 09:18:54 +0300 Subject: [PATCH] build-fix --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6bc520..835a2ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM rust:slim-bookworm AS build # Create larger temporary swap file for extreme memory optimization -RUN dd if=/dev/zero of=/tmp/swapfile bs=1M count=2048 && \ +RUN dd if=/dev/zero of=/tmp/swapfile bs=1M count=4096 && \ chmod 600 /tmp/swapfile && \ mkswap /tmp/swapfile && \ swapon /tmp/swapfile || true && \ # Set swappiness to use swap more aggressively - echo 60 > /proc/sys/vm/swappiness || true + echo 80 > /proc/sys/vm/swappiness || true # Install build dependencies RUN apt-get update && \ @@ -44,6 +44,9 @@ ENV CARGO_NET_TIMEOUT=60 ENV CARGO_HTTP_TIMEOUT=60 ENV CARGO_HTTP_LOW_SPEED_LIMIT=10 ENV RUSTC_FORCE_INCREMENTAL=0 +# Additional memory optimization for Redis connection pool compilation +ENV CARGO_BUILD_JOBS=1 +ENV RUSTFLAGS="-C opt-level=s -C target-cpu=generic" # Build dependencies only with extreme memory conservation RUN cargo build --release && \ # Force cleanup of intermediate files to free memory @@ -59,6 +62,8 @@ COPY ./src ./src # Build for release with aggressive memory cleanup RUN cargo build --release && \ + # Verify the binary was created + ls -la target/release/quoter && \ # Immediately strip the binary to save space strip target/release/quoter || true && \ # Clean up swap file