diff --git a/Dockerfile.fileviewer b/Dockerfile.fileviewer index d0558db73..4c24128d5 100644 --- a/Dockerfile.fileviewer +++ b/Dockerfile.fileviewer @@ -5,8 +5,11 @@ RUN apk add --no-cache ca-certificates bind-tools tini # We copy from the locally built zoekt image COPY --from=zoekt /usr/local/bin/zoekt-fileviewer /usr/local/bin/ +# Create the /app directory +RUN mkdir -p /app + # Copy the templates folder -COPY cmd/zoekt-fileviewer/templates /usr/local/bin/templates +COPY cmd/zoekt-fileviewer/templates /app/templates # 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 diff --git a/cmd/zoekt-fileviewer/main.go b/cmd/zoekt-fileviewer/main.go index 2fd06417f..c56a55e65 100644 --- a/cmd/zoekt-fileviewer/main.go +++ b/cmd/zoekt-fileviewer/main.go @@ -20,6 +20,7 @@ import ( var ( zoektRepoCache = flag.String("zoekt-repo-cache", "", "path to zoekt bare git repos") listen = flag.String("listen", ":8080", "listen on this address.") + docRoot = flag.String("doc-root", "", "where to find runtime files") ) const ( @@ -40,11 +41,14 @@ func main() { if *zoektRepoCache == "" { log.Fatal("--zoekt-repo-cache is required") } + if *docRoot == "" { + log.Fatal("--doc-root is required") + } // Create server configuration cfg := &config{ ZoektRepoCache: *zoektRepoCache, - DocRoot: ".", + DocRoot: *docRoot, ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, Port: *listen, diff --git a/cmd/zoekt-fileviewer/template.go b/cmd/zoekt-fileviewer/template.go index 8746ae176..3365e328f 100644 --- a/cmd/zoekt-fileviewer/template.go +++ b/cmd/zoekt-fileviewer/template.go @@ -458,7 +458,6 @@ func getFuncs() map[string]interface{} { } func LoadTemplates(base string, templates map[string]*template.Template) error { - log.Printf("in LoadTemplates\n") pattern := base + "/templates/common/*.html" common := template.New("").Funcs(getFuncs()) common = template.Must(common.ParseGlob(pattern))