From 6e7039e97618e1aaa1f5899555f86a1a71a7d3af Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Mon, 6 Feb 2023 13:11:02 +1100 Subject: [PATCH 1/2] Change zoekt-ci-image to main repo using SHA We choose a SHA here as this repo does not contain any useable tags and it does not seem that they keep tagged versions. Tracking master would probably be too risky as backwards incompatible changes could come up and break our CI environment which would be quite time consuming to debug. --- Dockerfile.zoekt-ci-image-1.0 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile.zoekt-ci-image-1.0 b/Dockerfile.zoekt-ci-image-1.0 index c607a36..934c23f 100644 --- a/Dockerfile.zoekt-ci-image-1.0 +++ b/Dockerfile.zoekt-ci-image-1.0 @@ -4,9 +4,12 @@ WORKDIR /usr/src/app RUN apt-get update && apt-get install -y universal-ctags git -RUN git clone https://github.com/DylanGriffith/zoekt.git -RUN cd /usr/src/app/zoekt && git checkout dynamic-indexserver-api && go install github.com/sourcegraph/zoekt/cmd/zoekt-dynamic-indexserver && go install github.com/sourcegraph/zoekt/cmd/zoekt-git-clone && go install github.com/sourcegraph/zoekt/cmd/zoekt-git-index -RUN cd /usr/src/app/zoekt && git checkout search-api-with-reposbranches-filter && go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver +ENV ZOEKT_VERSION=c08faec66fc26a41007b2176fbea86c52b0efe4b + +RUN go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver@$ZOEKT_VERSION && \ + go install github.com/sourcegraph/zoekt/cmd/zoekt-git-clone@$ZOEKT_VERSION && \ + go install github.com/sourcegraph/zoekt/cmd/zoekt-git-index@$ZOEKT_VERSION && \ + go install github.com/sourcegraph/zoekt/cmd/zoekt-dynamic-indexserver@$ZOEKT_VERSION COPY assets/zoekt-ci-image/run-zoekt-servers run-zoekt-servers From 2bc5e07db6b5fe9a2f48b01c65b7aa165b367f27 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Mon, 6 Feb 2023 17:21:07 +1100 Subject: [PATCH 2/2] Make zoekt-ci-image smaller This reduces the image size from around 2.2GB down to 100MB. This is to, hopefully, reduce issues we're seeing where our pipelines are running out of disk space. --- Dockerfile.zoekt-ci-image-1.0 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile.zoekt-ci-image-1.0 b/Dockerfile.zoekt-ci-image-1.0 index 934c23f..4360eaa 100644 --- a/Dockerfile.zoekt-ci-image-1.0 +++ b/Dockerfile.zoekt-ci-image-1.0 @@ -1,15 +1,22 @@ -FROM golang:1.19 +FROM golang:1.20.0-alpine3.17 as build WORKDIR /usr/src/app -RUN apt-get update && apt-get install -y universal-ctags git +RUN apk add git ENV ZOEKT_VERSION=c08faec66fc26a41007b2176fbea86c52b0efe4b -RUN go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver@$ZOEKT_VERSION && \ +RUN apk add go && \ + go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver@$ZOEKT_VERSION && \ go install github.com/sourcegraph/zoekt/cmd/zoekt-git-clone@$ZOEKT_VERSION && \ go install github.com/sourcegraph/zoekt/cmd/zoekt-git-index@$ZOEKT_VERSION && \ - go install github.com/sourcegraph/zoekt/cmd/zoekt-dynamic-indexserver@$ZOEKT_VERSION + go install github.com/sourcegraph/zoekt/cmd/zoekt-dynamic-indexserver@$ZOEKT_VERSION && \ + rm -rf /go/pkg /go/src /usr/local/go + +FROM alpine:3.17 as main +RUN apk add git + +COPY --from=build /go/bin/* /usr/bin/ COPY assets/zoekt-ci-image/run-zoekt-servers run-zoekt-servers