Fixed tensorflow-macos that fails on linux

This commit is contained in:
2026-01-03 01:08:49 +05:30
parent da08dbc444
commit 2970bdfc16
2 changed files with 13 additions and 7 deletions

View File

@@ -19,11 +19,14 @@ FROM python:3.11-slim
WORKDIR /app
# Install runtime dependencies only
# Install runtime dependencies (libgomp for OpenMP parallelism)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# FAISS uses OpenMP for parallel search - set threads for Xeon
ENV OMP_NUM_THREADS=8
# Copy installed packages from builder
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
@@ -34,10 +37,12 @@ COPY config.py .
COPY reverse_icon_search.py .
COPY run_api_server.py .
# Copy pre-built index and filenames (must be provided at build time or mounted)
# These files are large and should be mounted as volumes in production
# COPY index.faiss .
# COPY filenames.pkl .
# Copy pre-built index and filenames for inference
# Option 1: Bundle in image (~530 MB)
COPY index.faiss .
COPY filenames.pkl .
# Option 2: Mount as volume at runtime (uncomment above, use docker run -v)
# Create necessary directories
RUN mkdir -p uploads logs

View File

@@ -1,6 +1,7 @@
# Core ML/DL
tensorflow-macos
tensorflow-metal
tensorflow-macos; platform_system == "Darwin" and platform_machine == "arm64"
tensorflow-metal; platform_system == "Darwin" and platform_machine == "arm64"
tensorflow~=2.14.0; platform_system != "Darwin"
keras~=2.14.0
numpy~=1.26.2
scikit-learn~=1.3.2