Change lambda backend to support docker changes

This commit is contained in:
Loukas Leontopoulos 2018-02-19 17:28:35 +02:00
parent 553d074241
commit 3d7f584f64

View File

@ -104,7 +104,7 @@ class _DockerDataVolumeContext:
# It doesn't exist so we need to create it
self._vol_ref.volume = self._lambda_func.docker_client.volumes.create(self._lambda_func.code_sha_256)
container = self._lambda_func.docker_client.containers.run('alpine', 'sleep 100', volumes={self.name: '/tmp/data'}, detach=True)
container = self._lambda_func.docker_client.containers.run('alpine', 'sleep 100', volumes={self.name: {'bind': '/tmp/data', 'mode': 'rw'}}, detach=True)
try:
tar_bytes = zip2tar(self._lambda_func.code_bytes)
container.put_archive('/tmp/data', tar_bytes)
@ -309,7 +309,7 @@ class LambdaFunction(BaseModel):
finally:
if container:
try:
exit_code = container.wait(timeout=300)
exit_code = container.wait(timeout=300)['StatusCode']
except requests.exceptions.ReadTimeout:
exit_code = -1
container.stop()