From f8e38bf6dc908fa1b57ebbe76be9d46ef7ff5c60 Mon Sep 17 00:00:00 2001 From: Aaron Virshup Date: Tue, 6 Mar 2018 12:00:28 -0800 Subject: [PATCH] don't use dockerfile add --- pyccc/docker_utils.py | 2 +- pyccc/tests/test_dir_refs.py | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pyccc/docker_utils.py b/pyccc/docker_utils.py index 7c024cb..e86f4bb 100644 --- a/pyccc/docker_utils.py +++ b/pyccc/docker_utils.py @@ -62,7 +62,7 @@ def create_build_context(image, inputs, wdir): dest = path else: dest = os.path.join(wdir, path) - dockerlines.append('ADD %s %s' % (src, dest)) + dockerlines.append('COPY %s %s' % (src, dest)) build_context[src] = obj dockerstring = '\n'.join(dockerlines) diff --git a/pyccc/tests/test_dir_refs.py b/pyccc/tests/test_dir_refs.py index 49fb3eb..108d07c 100644 --- a/pyccc/tests/test_dir_refs.py +++ b/pyccc/tests/test_dir_refs.py @@ -57,8 +57,8 @@ def _get_dir_from_job_on_engine(engine, dir_archive): job = engine.launch(image='alpine', workingdir='/test', - inputs={'/test': archive_file}, - command='tar xvzf /test/archive.tar') + inputs={'/test/archive.tar': archive_file}, + command='tar xvf /test/archive.tar') job.wait() return job.get_directory('/test/data') @@ -100,3 +100,17 @@ def test_get_directory_with_subdirs(tmpdir): outdir.put(tmpdir) for path in ['a', 'b', 'fugu/fish']: assert os.path.exists(os.path.join(tmpdir, 'blah', path)) + + +def test_tar_archive_not_expanded(dir_archive): + engine = pyccc.Docker() + archive_file = pyccc.LocalFile(dir_archive.archive_path) + job = engine.launch(image='alpine', + workingdir='/test', + inputs={'/root/archive.tar': archive_file}, + command='ls /root') + job.wait() + files = job.stdout.split() + assert 'archive.tar' in files + assert 'data' not in files +