···11+#!/usr/bin/env bash
22+33+set -euo pipefail
44+55+# This is the pseudo-version that go.mod uses. We use the same version string
66+# so that downstream consumers can line up image versions with module versions.
77+version="$(TZ=UTC git --no-pager show \
88+ --quiet \
99+ --abbrev=12 \
1010+ --date='format-local:%Y%m%d%H%M%S' \
1111+ --format='0.0.0-%cd-%h')"
1212+1313+printf 'value=%s\n' "$version" >>"$GITHUB_OUTPUT"
···11-FROM alpine:3.19
22-33-RUN apk add --no-cache ca-certificates bind-tools tini git jansson
44-55-# Run as non-root user sourcegraph. External volumes should be mounted under /data (which will be owned by sourcegraph).
66-RUN mkdir -p /home/sourcegraph
77-RUN addgroup -S sourcegraph && adduser -S -G sourcegraph -h /home/sourcegraph sourcegraph && mkdir -p /data && chown -R sourcegraph:sourcegraph /data
88-USER sourcegraph
99-WORKDIR /home/sourcegraph
1010-1111-ENV SRC_FRONTEND_INTERNAL http://sourcegraph-frontend-internal
1212-ENV DATA_DIR /data/index
1313-RUN mkdir -p ${DATA_DIR}
1414-1515-COPY --from=zoekt \
1616- /usr/local/bin/universal-* \
1717- /usr/local/bin/zoekt-sourcegraph-indexserver \
1818- /usr/local/bin/zoekt-archive-index \
1919- /usr/local/bin/zoekt-git-index \
2020- /usr/local/bin/zoekt-merge-index \
2121- /usr/local/bin/
2222-2323-ENTRYPOINT ["/sbin/tini", "--", "zoekt-sourcegraph-indexserver"]
-24
Dockerfile.webserver
···11-FROM alpine:3.19
22-33-RUN apk add --no-cache ca-certificates bind-tools tini
44-55-# Run as non-root user sourcegraph. External volumes should be mounted under /data (which will be owned by sourcegraph).
66-RUN mkdir -p /home/sourcegraph
77-RUN addgroup -S sourcegraph && adduser -S -G sourcegraph -h /home/sourcegraph sourcegraph && mkdir -p /data && chown -R sourcegraph:sourcegraph /data
88-USER sourcegraph
99-WORKDIR /home/sourcegraph
1010-1111-ENV DATA_DIR /data/index
1212-RUN mkdir -p ${DATA_DIR}
1313-1414-# We copy from the locally built zoekt image
1515-COPY --from=zoekt /usr/local/bin/zoekt-webserver /usr/local/bin/
1616-1717-# zoekt-webserver has a large stable heap size (10s of gigs), and as such the
1818-# default GOGC=100 could be better tuned. https://dave.cheney.net/tag/gogc
1919-# In go1.18 the GC changed significantly and from experimentation we tuned it
2020-# down from 50 to 25.
2121-ENV GOGC=25
2222-2323-ENTRYPOINT ["/sbin/tini", "--"]
2424-CMD zoekt-webserver -index $DATA_DIR -pprof -rpc -indexserver_proxy
+19
README.md
···8282See the [query syntax docs](doc/query_syntax.md) for more details on the query
8383language.
84848585+#### Container image
8686+8787+Zoekt publishes a single container image at `ghcr.io/sourcegraph/zoekt`. It
8888+includes the Zoekt binaries, `git`, and `universal-ctags`. By default it runs
8989+`zoekt-webserver` against `/data/index`:
9090+9191+ docker run --rm -p 6070:6070 -v "$PWD/index:/data/index" ghcr.io/sourcegraph/zoekt
9292+9393+You can override the default command to run `zoekt-indexserver` instead. This
9494+example stores cloned repositories, logs, and indexes under `/data` and reads a
9595+mounted mirror config file:
9696+9797+ docker run --rm \
9898+ -v "$PWD/config.json:/config.json:ro" \
9999+ -v "$PWD/token.txt:/home/zoekt/token.txt:ro" \
100100+ -v "$PWD/zoekt-data:/data" \
101101+ ghcr.io/sourcegraph/zoekt \
102102+ zoekt-indexserver -mirror_config /config.json -data_dir /data
103103+85104If you start the web server with `-rpc`, it exposes a [simple JSON search
86105API](doc/json-api.md) at `http://localhost:6070/api/search`.
87106