Page MenuHomePhabricator

.dockerignore is not used to filter the build context
Closed, ResolvedPublic

Description

On CI the dockerfiles directories have example script that clone repo, use cache and logs. Some of the files end up owned by nobody on the host machine and can not be deleted. That causes docker-pkg to fail when creating the build environment despite a .dockerignore file.

def _create_build_environment(self):
    if self.build_path is not None:
        # Build path already created, assume it's all good
        return
    base = tempfile.mkdtemp(prefix='docker-pkg-{name}'.format(name=self.safe_name))
    build_path = os.path.join(base, 'context')
    shutil.copytree(self.path, build_path)
    self.build_path = build_path

It copies the whole tree (shutil.copytree).

The python docker module might have an helper to build the context and honor .dockerignore.

Event Timeline

Joe added a project: User-Joe.
Joe subscribed.

Change 420769 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/docker-images/docker-pkg@master] Honour .dockerignore when copying the build context

https://gerrit.wikimedia.org/r/420769

Joe triaged this task as High priority.Jun 19 2018, 8:14 AM

Change 420769 merged by Giuseppe Lavagetto:
[operations/docker-images/docker-pkg@master] Honour .dockerignore when copying the build context

https://gerrit.wikimedia.org/r/420769

Change 484547 had a related patch set uploaded (by Hashar; owner: Hashar):
[operations/docker-images/docker-pkg@master] Honor absolute paths in .dockerignore

https://gerrit.wikimedia.org/r/484547

Change 484547 abandoned by Hashar:
Honor absolute paths in .dockerignore

https://gerrit.wikimedia.org/r/484547