build-reconfig
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -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 && \
|
||||
|
||||
Reference in New Issue
Block a user