0.5.1
This commit is contained in:
35
.cargo/config.toml
Normal file
35
.cargo/config.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
[build]
|
||||
# Limit parallel compilation to reduce memory usage
|
||||
jobs = 1
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
# Aggressive memory optimization for CI/CD environments
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Wl,--no-keep-memory",
|
||||
"-C", "link-arg=-Wl,--reduce-memory-overheads",
|
||||
"-C", "codegen-units=1",
|
||||
"-C", "debuginfo=0",
|
||||
"-C", "opt-level=s",
|
||||
]
|
||||
|
||||
# Profile for optimized builds with lower memory usage
|
||||
[profile.release]
|
||||
# Enable thin LTO for balance between size and memory
|
||||
lto = "thin"
|
||||
# Reduce codegen units to save memory
|
||||
codegen-units = 1
|
||||
# Strip debug info in release
|
||||
strip = true
|
||||
# Optimize for size rather than speed
|
||||
opt-level = "s"
|
||||
# Reduce memory during compilation
|
||||
debug = false
|
||||
|
||||
# Development profile with memory constraints
|
||||
[profile.dev]
|
||||
# Disable debug info to save memory
|
||||
debug = false
|
||||
# Optimize for size even in dev builds
|
||||
opt-level = "s"
|
||||
# Minimal codegen units
|
||||
codegen-units = 1
|
||||
33
.dockerignore
Normal file
33
.dockerignore
Normal file
@@ -0,0 +1,33 @@
|
||||
# Rust build artifacts
|
||||
target/
|
||||
**/*.pdb
|
||||
|
||||
# Documentation and development files
|
||||
docs/progress/
|
||||
*.md
|
||||
!README.md
|
||||
|
||||
# Git and version control
|
||||
.git/
|
||||
.gitignore
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS specific files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Test and coverage files
|
||||
tests/
|
||||
lcov.info
|
||||
coverage.json
|
||||
|
||||
# Scripts and tools
|
||||
scripts/
|
||||
|
||||
# Large binary assets that aren't needed for build
|
||||
src/*.woff2
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,3 +1,21 @@
|
||||
## [0.5.1] - 2025-01-28
|
||||
|
||||
### Fixed
|
||||
- 🔧 **Агрессивная оптимизация Docker сборки** - решена проблема превышения памяти при компиляции AWS SDK
|
||||
- 🔧 Добавлена конфигурация `.cargo/config.toml` с максимальными оптимизациями компилятора
|
||||
- 🔧 Ограничение параллельных задач сборки до 1 (`jobs = 1`) для экономии памяти
|
||||
- 🔧 Оптимизированные флаги линковщика и отключение debug info
|
||||
- 🔧 Временный swap файл в Docker для критических случаев нехватки памяти
|
||||
- 🔧 Альтернативный `Dockerfile.minimal` для сред с экстремальными ограничениями
|
||||
- 🔧 `.dockerignore` для уменьшения контекста сборки
|
||||
|
||||
### Technical Details
|
||||
- **Компилятор**: `opt-level = "s"`, `debuginfo = 0`, `codegen-units = 1`
|
||||
- **Профили**: thin LTO, отключение debug info в dev и release
|
||||
- **Docker**: временный swap 1GB, поэтапная очистка памяти
|
||||
- **Линковщик**: `--no-keep-memory`, `--reduce-memory-overheads`
|
||||
- **Fallback**: Dockerfile.minimal без dependency caching для критических случаев
|
||||
|
||||
## [0.5.0] - 2025-09-01
|
||||
|
||||
### Added
|
||||
|
||||
30
Dockerfile
30
Dockerfile
@@ -1,6 +1,12 @@
|
||||
# Build stage
|
||||
# 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 && \
|
||||
chmod 600 /tmp/swapfile && \
|
||||
mkswap /tmp/swapfile && \
|
||||
swapon /tmp/swapfile || true
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
@@ -24,13 +30,19 @@ RUN USER=root cargo new --bin quoter
|
||||
|
||||
WORKDIR /quoter
|
||||
|
||||
# Copy manifests
|
||||
# Copy manifests and cargo config
|
||||
COPY ./Cargo.lock ./Cargo.lock
|
||||
COPY ./Cargo.toml ./Cargo.toml
|
||||
COPY ./.cargo ./.cargo
|
||||
|
||||
# Cache dependencies
|
||||
# Cache dependencies with memory optimization
|
||||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
||||
RUN cargo build --release
|
||||
# Build dependencies only
|
||||
RUN cargo build --release 2>&1 | head -100 && \
|
||||
# Force cleanup of intermediate files to free memory
|
||||
cargo clean -p quoter && \
|
||||
# Keep only the dependency artifacts
|
||||
find target/release/deps -name "quoter*" -delete
|
||||
|
||||
# Remove the default source file created by cargo new
|
||||
RUN rm src/*.rs
|
||||
@@ -38,9 +50,13 @@ RUN rm src/*.rs
|
||||
# Copy source code
|
||||
COPY ./src ./src
|
||||
|
||||
# Build for release
|
||||
RUN rm ./target/release/deps/quoter*
|
||||
RUN cargo build --release
|
||||
# Build for release with aggressive memory cleanup
|
||||
RUN cargo build --release && \
|
||||
# Immediately strip the binary to save space
|
||||
strip target/release/quoter || true && \
|
||||
# Clean up swap file
|
||||
swapoff /tmp/swapfile || true && \
|
||||
rm -f /tmp/swapfile
|
||||
|
||||
# Final stage
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
Reference in New Issue
Block a user