From 44bc5ed2f5bbd6ee3e61070d2bd1dfd088d46ae0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Jan 2026 14:08:16 +0000 Subject: [PATCH] Fix rembg/onnxruntime Docker build issue - Use onnxruntime 1.14.1 (older version without executable stack requirement) - Make rembg pre-download optional (won't fail build if onnxruntime has issues) - Remove Background will be disabled if rembg can't load --- Dockerfile | 7 ++++--- backend/requirements.txt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6a50c8..42b64bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,9 +37,10 @@ RUN apt-get update && apt-get install -y \ COPY backend/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -# Pre-download rembg model (u2net) to avoid first-run delay -# Note: This downloads the U2-Net model (~170MB) during build -RUN python -c "from rembg import remove; print('rembg model downloaded')" +# Try to pre-download rembg model, but don't fail build if onnxruntime has issues +# (onnxruntime can have executable stack issues in some Docker environments) +# If this fails, Remove Background feature will be disabled +RUN python -c "from rembg import remove; print('rembg ready')" || echo "WARNING: rembg not available - Remove Background will be disabled" # Copy backend application COPY backend/ . diff --git a/backend/requirements.txt b/backend/requirements.txt index 8553437..906aabf 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -14,8 +14,8 @@ pydantic-settings==2.1.0 email-validator==2.1.0 opencv-python-headless==4.9.0.80 scikit-image==0.22.0 -# rembg for background removal - use onnxruntime 1.15.1 to avoid executable stack issue -onnxruntime==1.15.1 +# rembg for background removal - use onnxruntime 1.14.1 to avoid executable stack issue in Docker +onnxruntime==1.14.1 rembg==2.0.50 # SAM (Segment Anything) for smart object selection - runs locally, no API needed torch==2.1.2