fork of https://github.com/sourcegraph/zoekt
1FROM golang:1.21.4-alpine3.18 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.18 AS rust-builder
17
18RUN apk update --no-cache && apk upgrade --no-cache && \
19 apk add --no-cache git wget musl-dev>=1.1.24-r10 build-base
20
21RUN wget -qO- https://github.com/sourcegraph/sourcegraph/archive/0c8aa18eece45922a2b56dc0f94e21b1bb533e7d.tar.gz | tar xz && mv sourcegraph-* sourcegraph
22
23ARG TARGETARCH
24
25# Because .cargo/config.toml doesnt support triplet-specific env
26RUN cd sourcegraph/docker-images/syntax-highlighter && /sourcegraph/cmd/symbols/cargo-config.sh && cd /
27
28RUN cargo install --path sourcegraph/docker-images/syntax-highlighter --root /syntect_server --bin scip-ctags
29
30FROM alpine:3.18 AS zoekt
31
32RUN apk update --no-cache && apk upgrade --no-cache && \
33 apk add --no-cache git ca-certificates bind-tools tini jansson wget
34
35COPY install-ctags-alpine.sh .
36RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh
37
38COPY --from=builder /go/bin/* /usr/local/bin/
39COPY --from=rust-builder /syntect_server/bin/scip-ctags /usr/local/bin/scip-ctags
40
41ENTRYPOINT ["/sbin/tini", "--"]