diff options
author | Joffrey F <joffrey@docker.com> | 2018-03-30 10:22:39 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-03-30 10:41:18 -0700 |
commit | 72ad0d85eb9a1df1711917504efbcf6f418be1fe (patch) | |
tree | 3885fc3eedd860a35bc17a9a94b138e2b3fbb8f9 /tests/integration | |
parent | bdee6e308734dfb0d1cd959575222b081e150d2f (diff) | |
download | docker-py-1980-relative-dockerfile.tar.gz |
Properly handle relative Dockerfile paths and Dockerfile on different drives1980-relative-dockerfile
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/api_build_test.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/integration/api_build_test.py b/tests/integration/api_build_test.py index f411efc..8910eb7 100644 --- a/tests/integration/api_build_test.py +++ b/tests/integration/api_build_test.py @@ -440,3 +440,35 @@ class BuildTest(BaseAPIIntegrationTest): lsdata = self.client.logs(ctnr).strip().split(b'\n') assert len(lsdata) == 3 assert sorted([b'.', b'..', b'file.txt']) == sorted(lsdata) + + def test_build_in_context_dockerfile(self): + base_dir = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, base_dir) + with open(os.path.join(base_dir, 'file.txt'), 'w') as f: + f.write('hello world') + with open(os.path.join(base_dir, 'custom.dockerfile'), 'w') as df: + df.write('\n'.join([ + 'FROM busybox', + 'COPY . /src', + 'WORKDIR /src', + ])) + print(os.path.join(base_dir, 'custom.dockerfile')) + img_name = random_name() + self.tmp_imgs.append(img_name) + stream = self.client.build( + path=base_dir, dockerfile='custom.dockerfile', tag=img_name, + decode=True + ) + lines = [] + for chunk in stream: + lines.append(chunk) + assert 'Successfully tagged' in lines[-1]['stream'] + + ctnr = self.client.create_container(img_name, 'ls -a') + self.tmp_containers.append(ctnr) + self.client.start(ctnr) + lsdata = self.client.logs(ctnr).strip().split(b'\n') + assert len(lsdata) == 4 + assert sorted( + [b'.', b'..', b'file.txt', b'custom.dockerfile'] + ) == sorted(lsdata) |