Skip to content

Pass GOOGLE_SEARCH_KEY as a build argument

Achilleas Pipinellis requested to merge axil-g-search-key-build-arg into main

What does this MR do and why?

We need to pass the GOOGLE_SEARCH_KEY as a build argument when building the stable images, otherwise it will be empty.

In !3869 (merged), we added the variable in the Dockerfile, but forgot to pass it as an argument at build time.

How to set up and validate locally

  1. Check that the variable is empty for the already built image:

    $ docker run --rm registry.gitlab.com/gitlab-org/gitlab-docs:16.0 grep GOOGLE_SEARCH_KEY "/usr/share/nginx/html/16.0/index.html"
    
    <script>const GOOGLE_SEARCH_KEY=""</script>
  2. Build the 16.0 image and pass the variable:

    docker build --build-arg NANOC_ENV=production --build-arg VER=16.0 --build-arg SEARCH_BACKEND="google" --build-arg GOOGLE_SEARCH_KEY="12344" --tag docs:16.0 -f dockerfiles/single.Dockerfile .
  3. Check that the variable is there:

    $ docker run --rm docs:16.0 grep GOOGLE_SEARCH_KEY "/usr/share/nginx/html/16.0/index.html"
    
    <script>const GOOGLE_SEARCH_KEY="1234"</script>
Edited by Achilleas Pipinellis

Merge request reports