diff --git a/Dockerfile.cicd b/Dockerfile.cicd index af49aad..0d76cb8 100644 --- a/Dockerfile.cicd +++ b/Dockerfile.cicd @@ -145,26 +145,33 @@ RUN dd if=/dev/zero of=/tmp/swapfile bs=1M count=1024 2>/dev/null && \ mkswap /tmp/swapfile && \ swapon /tmp/swapfile || echo "Swap setup failed, continuing without swap" -# Configure Yarn for CI environment with memory optimizations -RUN echo "# CI optimizations" >> .yarnrc.yml && \ - echo "httpTimeout: 60000" >> .yarnrc.yml && \ +# Configure Yarn for extreme memory constraints (ARM64) +RUN echo "# CI optimizations for ARM64 memory constraints" >> .yarnrc.yml && \ + echo "httpTimeout: 120000" >> .yarnrc.yml && \ echo "enableGlobalCache: false" >> .yarnrc.yml && \ echo "compressionLevel: 0" >> .yarnrc.yml && \ echo "nmMode: hardlinks-local" >> .yarnrc.yml && \ - echo "httpRetry: 3" >> .yarnrc.yml && \ - echo "networkConcurrency: 2" >> .yarnrc.yml + echo "httpRetry: 5" >> .yarnrc.yml && \ + echo "networkConcurrency: 1" >> .yarnrc.yml && \ + echo "enableScripts: false" >> .yarnrc.yml && \ + echo "preferDeferredVersions: true" >> .yarnrc.yml -# Install frontend dependencies with aggressive memory management -RUN export NODE_OPTIONS="--max-old-space-size=1536 --max-semi-space-size=128" && \ - ulimit -v 2097152 2>/dev/null || true && \ +# Install frontend dependencies with extreme memory constraints for ARM64 +RUN export NODE_OPTIONS="--max-old-space-size=512 --max-semi-space-size=64 --initial-old-space-size=128 --optimize-for-size" && \ + export UV_WORKERS=1 && \ + ulimit -v 1048576 2>/dev/null || true && \ + echo "Memory info before install:" && \ + free -h || true && \ for i in 1 2 3; do \ - echo "Attempt $i: Installing frontend dependencies..." && \ - timeout 1800 yarn install --immutable \ + echo "Attempt $i: Installing frontend dependencies with minimal memory..." && \ + sync && echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true && \ + timeout 3600 yarn install --immutable --mode=skip-build \ && break || \ - (echo "Attempt $i failed, cleaning up and retrying..." && \ + (echo "Attempt $i failed, cleaning up and waiting for memory recovery..." && \ rm -rf node_modules .yarn/cache .yarn/install-state.gz && \ yarn cache clean --all 2>/dev/null || true && \ - sleep 30); \ + sync && echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true && \ + sleep 60); \ done && \ rm -rf .yarn/cache && \ swapoff /tmp/swapfile 2>/dev/null || true && \