fork of https://github.com/sourcegraph/zoekt
1FROM golang:1.22.2-alpine3.19 AS builder
2
3RUN apk add --no-cache ca-certificates
4
5ENV CGO_ENABLED=0
6WORKDIR /go/src/github.com/sourcegraph/zoekt
7
8# Cache dependencies
9COPY go.mod go.sum ./
10RUN go mod download
11
12COPY . ./
13ARG VERSION
14RUN go install -ldflags "-X github.com/sourcegraph/zoekt.Version=$VERSION" ./cmd/...
15
16FROM rust:alpine3.19 AS rust-builder
17
18RUN apk add --no-cache git wget musl-dev build-base
19
20RUN wget -qO- https://github.com/sourcegraph/sourcegraph/archive/0c8aa18eece45922a2b56dc0f94e21b1bb533e7d.tar.gz | tar xz && mv sourcegraph-* sourcegraph
21
22ARG TARGETARCH
23
24# Because .cargo/config.toml doesnt support triplet-specific env
25RUN cd sourcegraph/docker-images/syntax-highlighter && /sourcegraph/cmd/symbols/cargo-config.sh && cd /
26
27RUN cargo install --path sourcegraph/docker-images/syntax-highlighter --root /syntect_server --bin scip-ctags
28
29FROM alpine:3.19 AS zoekt
30
31RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget
32
33COPY install-ctags-alpine.sh .
34RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh
35
36COPY --from=builder /go/bin/* /usr/local/bin/
37COPY --from=rust-builder /syntect_server/bin/scip-ctags /usr/local/bin/scip-ctags
38
39ENTRYPOINT ["/sbin/tini", "--"]