From f40f18fd6698a4501c114b67448e1289f73ef563 Mon Sep 17 00:00:00 2001 From: bkellam Date: Fri, 30 Aug 2024 19:03:13 -0700 Subject: [PATCH] Add zoekt webserver dockerfile --- Dockerfile.zoekt-webserver | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ entrypoint.zoekt-webserver.sh | 4 ++++ 3 files changed, 48 insertions(+) create mode 100644 Dockerfile.zoekt-webserver create mode 100644 entrypoint.zoekt-webserver.sh diff --git a/Dockerfile.zoekt-webserver b/Dockerfile.zoekt-webserver new file mode 100644 index 00000000..195a5d9e --- /dev/null +++ b/Dockerfile.zoekt-webserver @@ -0,0 +1,30 @@ +FROM golang:1.22.2-alpine3.19 AS 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/ ./cmd/... + +FROM alpine:3.19 AS zoekt +WORKDIR /app +RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget + +ENV DATA_DIR /zoekt-data/ +RUN mkdir -p ${DATA_DIR} + +COPY entrypoint.zoekt-webserver.sh ./entrypoint.sh +RUN chmod +x ./entrypoint.sh + +COPY --from=builder \ + /cmd/zoekt-webserver \ + /usr/local/bin/ + +EXPOSE 6070 + +ENTRYPOINT ["/sbin/tini", "--", "./entrypoint.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index be6520ba..5ca498b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,5 +6,19 @@ services: environment: - GITHUB_TOKEN=${GITHUB_TOKEN} - CONFIG_PATH=/app/configs/config.json + - DATA_DIR=/zoekt-data/ volumes: - ./configs/config.json:/app/configs/config.json:r + - zoekt_index_cache:/zoekt-data/ + zoekt-webserver: + build: + dockerfile: Dockerfile.zoekt-webserver + environment: + - DATA_DIR=/zoekt-data/ + ports: + - 6070:6070 + volumes: + - zoekt_index_cache:/zoekt-data/ + +volumes: + zoekt_index_cache: \ No newline at end of file diff --git a/entrypoint.zoekt-webserver.sh b/entrypoint.zoekt-webserver.sh new file mode 100644 index 00000000..58624537 --- /dev/null +++ b/entrypoint.zoekt-webserver.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +exec "zoekt-webserver" "-index" "${DATA_DIR}/index" \ No newline at end of file