Skip to content

Commit

Permalink
Merge pull request #26 from Autodesk/dont-use-dockerfile-add
Browse files Browse the repository at this point in the history
Use COPY, not ADD, when building job images
  • Loading branch information
avirshup committed Mar 9, 2018
2 parents 89bb7c6 + f8e38bf commit 25ac40d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyccc/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 16 additions & 2 deletions pyccc/tests/test_dir_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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

0 comments on commit 25ac40d

Please sign in to comment.