Skip to content

Commit

Permalink
feat(layers): remove compression of docker context (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanSmith authored and jfuss committed Jan 18, 2019
1 parent 9fce3b4 commit 4259a52
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion samcli/lib/utils/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_tarball(tar_paths):
"""
tarballfile = TemporaryFile()

with tarfile.open(fileobj=tarballfile, mode='w:gz') as archive:
with tarfile.open(fileobj=tarballfile, mode='w') as archive:
for path_on_system, path_in_tarball in tar_paths.items():
archive.add(path_on_system, arcname=path_in_tarball)

Expand Down
1 change: 0 additions & 1 deletion samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def _build_image(self, base_image, docker_tag, layers):
self.docker_client.images.build(fileobj=tarballfile,
custom_context=True,
rm=True,
encoding='gzip',
tag=docker_tag,
pull=not self.skip_pull_image)
except (docker.errors.BuildError, docker.errors.APIError):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib/utils/test_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def test_generating_tarball(self, temporary_file_patch, tarfile_open_patch):
temp_file_mock.flush.assert_called_once()
temp_file_mock.seek.assert_called_once_with(0)
temp_file_mock.close.assert_called_once()
tarfile_open_patch.assert_called_once_with(fileobj=temp_file_mock, mode='w:gz')
tarfile_open_patch.assert_called_once_with(fileobj=temp_file_mock, mode='w')
9 changes: 3 additions & 6 deletions tests/unit/local/docker/test_lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ def test_build_image(self, generate_dockerfile_patch, path_patch, uuid_patch, cr
rm=True,
tag="docker_tag",
pull=False,
custom_context=True,
encoding='gzip')
custom_context=True)

docker_full_path_mock.unlink.assert_called_once()

Expand Down Expand Up @@ -218,8 +217,7 @@ def test_build_image_fails_with_BuildError(self,
rm=True,
tag="docker_tag",
pull=False,
custom_context=True,
encoding='gzip')
custom_context=True)

docker_full_path_mock.unlink.assert_not_called()

Expand Down Expand Up @@ -264,6 +262,5 @@ def test_build_image_fails_with_ApiError(self,
rm=True,
tag="docker_tag",
pull=False,
custom_context=True,
encoding='gzip')
custom_context=True)
docker_full_path_mock.unlink.assert_called_once()

0 comments on commit 4259a52

Please sign in to comment.