fork of https://github.com/sourcegraph/zoekt
1FROM alpine:3.18
2
3RUN apk update --no-cache && apk upgrade --no-cache && \
4 apk add --no-cache ca-certificates bind-tools tini
5
6# Run as non-root user sourcegraph. External volumes should be mounted under /data (which will be owned by sourcegraph).
7RUN mkdir -p /home/sourcegraph
8RUN addgroup -S sourcegraph && adduser -S -G sourcegraph -h /home/sourcegraph sourcegraph && mkdir -p /data && chown -R sourcegraph:sourcegraph /data
9USER sourcegraph
10WORKDIR /home/sourcegraph
11
12ENV DATA_DIR /data/index
13RUN mkdir -p ${DATA_DIR}
14
15# We copy from the locally built zoekt image
16COPY --from=zoekt /usr/local/bin/zoekt-webserver /usr/local/bin/
17
18# zoekt-webserver has a large stable heap size (10s of gigs), and as such the
19# default GOGC=100 could be better tuned. https://dave.cheney.net/tag/gogc
20# In go1.18 the GC changed significantly and from experimentation we tuned it
21# down from 50 to 25.
22ENV GOGC=25
23
24ENTRYPOINT ["/sbin/tini", "--"]
25CMD zoekt-webserver -index $DATA_DIR -pprof -rpc -indexserver_proxy