From a1dd81b981a90538e27c15daf039f686784c1f47 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Jan 2026 04:49:32 +0000 Subject: [PATCH] Fix onnxruntime executable stack error in Docker build The onnxruntime library requires an executable stack which is blocked by security restrictions in Docker containers. This adds execstack tool and uses it to clear the executable stack flag after pip install. https://claude.ai/code/session_01AGoPJaXqdJnnuxtmSv6NLR --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index a6a50c8..a885f13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ FROM python:3.11-slim WORKDIR /app # Install system dependencies for OpenCV, rembg, SAM, and image processing +# execstack is needed to fix onnxruntime executable stack issue in containers RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ @@ -31,12 +32,17 @@ RUN apt-get update && apt-get install -y \ libgomp1 \ wget \ git \ + execstack \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY backend/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +# Fix onnxruntime executable stack issue in containers +# This clears the executable stack requirement from the onnxruntime library +RUN execstack -c /usr/local/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so || true + # 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')"