FROM python:3.11-slim ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 WORKDIR /app # Build dependencies RUN apt-get update && apt-get install -y \ git \ cmake \ build-essential \ curl \ wget \ ca-certificates \ libjpeg-dev \ libpng-dev \ && rm -rf /var/lib/apt/lists/* # --------------------------------------------------------- # Build locate-anything.cpp # CPU ONLY # --------------------------------------------------------- RUN git clone --recursive \ https://github.com/mudler/locate-anything.cpp.git \ /opt/locate-anything WORKDIR /opt/locate-anything RUN cmake -B build \ -DCMAKE_BUILD_TYPE=Release \ -DLA_BUILD_CLI=ON \ -DLA_BUILD_TESTS=OFF \ -DLA_GGML_CUDA=OFF \ -DLA_GGML_VULKAN=OFF \ -DLA_GGML_METAL=OFF RUN cmake --build build \ --config Release \ -j2 # Put CLI somewhere easy to call RUN find /opt/locate-anything/build \ -type f \ -name "locate-anything-cli" \ -exec cp {} /usr/local/bin/locate-anything-cli \; RUN chmod +x /usr/local/bin/locate-anything-cli # --------------------------------------------------------- # Python web server # --------------------------------------------------------- WORKDIR /app COPY requirements.txt . RUN pip install \ --no-cache-dir \ -r requirements.txt COPY . . # --------------------------------------------------------- # Model # --------------------------------------------------------- RUN mkdir -p /models RUN wget -O /models/locate-anything-q4_k.gguf \ https://huggingface.co/mudler/locate-anything.cpp-gguf/resolve/main/locate-anything-q4_k.gguf # --------------------------------------------------------- # Environment # --------------------------------------------------------- ENV LOCATEANYTHING_MODEL=/models/locate-anything-q4_k.gguf ENV LA_DEVICE=cpu ENV OMP_NUM_THREADS=2 EXPOSE 7860 CMD ["python", "app.py"]