sourcebot/Dockerfile.zoekt

31 lines
1,008 B
Docker

FROM golang:1.23.4-alpine3.19 AS zoekt-builder
RUN apk add --no-cache ca-certificates
WORKDIR /zoekt
COPY vendor/zoekt/go.mod vendor/zoekt/go.sum ./
RUN go mod download
COPY vendor/zoekt ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /cmd/zoekt-webserver ./cmd/zoekt-webserver
FROM alpine:3.19 AS runner
RUN apk add --no-cache ca-certificates bind-tools tini
# Install ctags
COPY vendor/zoekt/install-ctags-alpine.sh .
RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh
# Set up data directory
ENV DATA_DIR /data/index
RUN mkdir -p ${DATA_DIR}
# Copy the zoekt-webserver binary
COPY --from=zoekt-builder /cmd/zoekt-webserver /usr/local/bin/
# zoekt-webserver has a large stable heap size (10s of gigs), and as such the
# default GOGC=100 could be better tuned. https://dave.cheney.net/tag/gogc
# In go1.18 the GC changed significantly and from experimentation we tuned it
# down from 50 to 25.
ENV GOGC=25
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["zoekt-webserver", "-index", "/data/index", "-rpc"]