]> granicus.if.org Git - graphviz/commitdiff
Change Docker context to be the repo root
authorMark Hansen <markhansen@google.com>
Wed, 24 Feb 2021 09:52:57 +0000 (20:52 +1100)
committerMark Hansen <markhansen@google.com>
Wed, 24 Feb 2021 09:52:57 +0000 (20:52 +1100)
See https://stackoverflow.com/a/24540011/171898 and
https://docs.docker.com/engine/reference/builder/#usage

The directory passed to docker is the context. Previously we changed
directory into `ci/$IMAGE` then passed `.` as the "context".

Passing a subdir as context prevents any inclusion of files outside the
context, which isn't what we want: we want to include `requirements.txt`
from the root.

So instead, pass the entire repo as "context", and use the "-f" flag to
set the Dockerfile used.

Should help with #1743 and !1784

.gitlab-ci.yml

index a11ec375919cf4420281a27babf2de2f287c1d7f..ca887acc061f17749f7ec50f33fd40caa449bb16 100644 (file)
@@ -646,11 +646,10 @@ deployment:
   <<: *docker_definition
   stage: build_docker_images
   script:
-    - cd ci/$IMAGE
     # fetches the :latest image (not failing if image is not found) for caching
     - docker pull $CI_REGISTRY_IMAGE/$IMAGE:latest || true
     # Build and push with git commit SHA tag, reusing layers from the :latest image if possible
-    - docker build -t $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA --cache-from $CI_REGISTRY_IMAGE/$IMAGE:latest .
+    - docker build -t $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA --cache-from $CI_REGISTRY_IMAGE/$IMAGE:latest -f ci/$IMAGE/Dockerfile .
     - docker push     $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA
 
 .docker_push_template: &docker_push_definition