build-reconfig
Some checks failed
Deploy / deploy (push) Has been skipped
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2025-09-02 09:09:34 +03:00
parent 1aace5fd19
commit b1270c5cb6
5 changed files with 43 additions and 712 deletions

View File

@@ -1,11 +1,13 @@
# Build stage with memory optimization
FROM rust:slim-bookworm AS build
# Create temporary swap file to help with memory-intensive compilation
RUN dd if=/dev/zero of=/tmp/swapfile bs=1M count=1024 && \
# Create larger temporary swap file for extreme memory optimization
RUN dd if=/dev/zero of=/tmp/swapfile bs=1M count=2048 && \
chmod 600 /tmp/swapfile && \
mkswap /tmp/swapfile && \
swapon /tmp/swapfile || true
swapon /tmp/swapfile || true && \
# Set swappiness to use swap more aggressively
echo 60 > /proc/sys/vm/swappiness || true
# Install build dependencies
RUN apt-get update && \
@@ -35,9 +37,14 @@ COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./.cargo ./.cargo
# Cache dependencies with memory optimization
# Extreme memory optimization environment variables
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Build dependencies only
ENV CARGO_NET_RETRY=3
ENV CARGO_NET_TIMEOUT=60
ENV CARGO_HTTP_TIMEOUT=60
ENV CARGO_HTTP_LOW_SPEED_LIMIT=10
ENV RUSTC_FORCE_INCREMENTAL=0
# Build dependencies only with extreme memory conservation
RUN cargo build --release 2>&1 | head -100 && \
# Force cleanup of intermediate files to free memory
cargo clean -p quoter && \