# roadsketch — FastAPI shape-search server over a prebuilt FAISS road index.
# The index itself is NOT in the image (3.1GB, lives at /srv/roadsketch/index
# on the host and is volume-mounted read-only by the compose file).
FROM python:3.13-slim

WORKDIR /app

# Progress bars off: pip's \r-progress accumulates into one enormous log
# "line" that overflows ctrl's deploy-log stream reader and kills the build.
ENV PIP_PROGRESS_BAR=off PIP_NO_COLOR=1

# Deps first for layer caching. faiss-cpu ships manylinux aarch64 wheels;
# if a pip resolve ever fails here on ARM, see DEPLOY.md for alternatives.
COPY requirements.txt /app/
RUN pip install -q --no-cache-dir -r requirements.txt

COPY pipeline/ /app/pipeline/
COPY server/ /app/server/
COPY web/ /app/web/

EXPOSE 8899
# Single process on purpose: the FAISS index is ~1.4GB resident, so extra
# workers would multiply that. Concurrency comes from the threadpool that
# FastAPI runs sync endpoints in (faiss releases the GIL during search).
CMD ["python", "server/app.py"]
