From: Mark Hansen Date: Wed, 24 Feb 2021 09:52:57 +0000 (+1100) Subject: Change Docker context to be the repo root X-Git-Tag: 2.47.0~41^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0264d08ecc3b5e72fcc12e04d53935f50ed75b5;p=graphviz Change Docker context to be the repo root 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 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a11ec3759..ca887acc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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