Skip to content

https://arxiv.org/abs/2606.28344. The end of web parsing. The beginning of scalable pixel-native search. link: https://pixelrag.ai/

fix(docker): make the compose stack start, and the image build off x86_64 (#183)

Shubham Srivastavaffa1ff0dca1f
diff --git a/Dockerfile b/Dockerfile
index 69f4e95..0313e28 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -62,7 +62,21 @@ COPY index/src ./index/src
COPY serve/src ./serve/src
RUN uv sync --frozen --extra serve
-RUN uv run pixelshot install-chrome
+
+# The pinned headless_shell is published for linux-x64 only — install_chrome()
+# raises on anything else, which failed `docker compose up --build` outright on
+# Apple Silicon. Skip it off amd64 instead: the image still serves search over a
+# prebuilt index, and anything needing a renderer fails at run time with
+# chrome.py's own message. Build with --platform linux/amd64 for a
+# renderer-capable image. The mkdir keeps the runtime stage's COPY valid when
+# the install is skipped.
+ARG TARGETARCH
+RUN mkdir -p /root/.cache/pixelrag/chrome && \
+ arch="${TARGETARCH:-$(uname -m)}" && \
+ case "$arch" in \
+ amd64|x86_64) uv run pixelshot install-chrome ;; \
+ *) echo "skipping install-chrome: no prebuilt headless_shell for $arch" ;; \
+ esac
FROM python:3.12-slim-bookworm AS runtime
diff --git a/README.md b/README.md
index 18c5e7b..7a6491f 100644
--- a/README.md
+++ b/README.md
@@ -324,10 +324,18 @@ index:
### Run the API in Docker
`Dockerfile` builds a two-stage image that installs the `serve` extra and a pinned Chromium,
-and `docker-compose.yml` runs `pixelrag serve` on port 8000 against mounted index and tile
-volumes:
+and `docker-compose.yml` runs `pixelrag serve` on port 8000 against the index and tiles you
+mount from the host.
+
+**Build an index first.** The container mounts `./data/index` read-only and cannot create one,
+so `docker compose up` against an empty directory exits before the server starts — `pixelrag
+serve` opens the index and `articles.json` during startup. Point `output:` at it in your
+`pixelrag.yaml` (as above), then:
```bash
+mkdir -p data/index data/tiles
+pixelrag index build # writes index.faiss, metadata.npz and articles.json to ./data/index
+
docker compose up --build
# then query it
curl -X POST http://localhost:8000/search \
@@ -335,13 +343,14 @@ curl -X POST http://localhost:8000/search \
-d '{"queries": [{"text": "What is the capital of France?"}], "n_docs": 5}'
```
-Populate the `pixelrag-index` volume with an index built as described above; the container
-reads it read-only and writes only tiles.
-
-Two things to know before using it:
+Three things to know before using it:
- **Nothing in CI builds this image.** It is best-effort and can drift when dependencies or
source paths move, so build it yourself before relying on it.
+- **On Apple Silicon the image builds without a renderer.** The pinned `headless_shell` is
+ published for linux-x64 only, so the build skips it on other architectures: search over a
+ prebuilt index works, on-demand rendering does not. For a renderer-capable image, build for
+ amd64 (emulated, and slower) by adding `platform: linux/amd64` to the `pixelrag-api` service.
- **The container runs as root, so Chrome renders with its sandbox disabled.** Chrome's
sandbox inside a container requires `--cap-add=SYS_ADMIN` or a tailored seccomp profile,
and a non-root `USER` without those stops Chrome launching entirely. Container isolation
diff --git a/docker-compose.yml b/docker-compose.yml
index 1096d4f..a9fe666 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,9 +11,10 @@ services:
PIXELRAG_TILES_DIR: /data/tiles
PIXELRAG_ARTICLES_JSON: /data/index/articles.json
volumes:
- - pixelrag-index:/data/index:ro
- - pixelrag-tiles:/data/tiles
-
-volumes:
- pixelrag-index:
- pixelrag-tiles:
+ # Host paths, not named volumes. The index is built on the host
+ # (`pixelrag index build`), and nothing in this stack can write a
+ # read-only named volume — so a first run against an empty one exited
+ # before uvicorn started. ./data/index rather than ./index: ./index is
+ # the pixelrag_index source package.
+ - ./data/index:/data/index:ro
+ - ./data/tiles:/data/tiles