Skip to content

Commit 5255e9d

Browse files
authored
Use Amazon ECR images for mimicing lambda with docker (aws-cloudformation#193)
1 parent 9ca34e2 commit 5255e9d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

python/rpdk/python/codegen.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Python36LanguagePlugin(LanguagePlugin):
4343
RESOURCE_ENTRY_POINT = "{}.handlers.resource"
4444
TEST_ENTRY_POINT = "{}.handlers.test_entrypoint"
4545
CODE_URI = "build/"
46+
DOCKER_TAG = 3.6
4647

4748
def __init__(self):
4849
self.env = self._setup_jinja_env(
@@ -274,7 +275,7 @@ def _docker_build(cls, external_path):
274275
LOG.debug("command is '%s'", command)
275276

276277
volumes = {str(external_path): {"bind": str(internal_path), "mode": "rw"}}
277-
image = f"lambci/lambda:build-{cls.RUNTIME}"
278+
image = f"public.ecr.aws/lambda/python:{cls.DOCKER_TAG}"
278279
LOG.warning(
279280
"Starting Docker build. This may take several minutes if the "
280281
"image '%s' needs to be pulled first.",
@@ -288,6 +289,7 @@ def _docker_build(cls, external_path):
288289
auto_remove=True,
289290
volumes=volumes,
290291
stream=True,
292+
entrypoint="",
291293
user=f"{os.geteuid()}:{os.getgid()}",
292294
)
293295
except RequestsConnectionError as e:
@@ -325,3 +327,4 @@ def _pip_build(cls, base_path):
325327
class Python37LanguagePlugin(Python36LanguagePlugin):
326328
NAME = "python37"
327329
RUNTIME = "python3.7"
330+
DOCKER_TAG = 3.7

tests/plugin/codegen_test.py

+2
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ def test__docker_build_good_path(plugin, tmp_path):
438438
auto_remove=True,
439439
volumes={str(tmp_path): {"bind": "/project", "mode": "rw"}},
440440
stream=True,
441+
entrypoint="",
441442
user=ANY,
442443
)
443444

@@ -479,5 +480,6 @@ def test__docker_build_bad_path(plugin, tmp_path, exception):
479480
auto_remove=True,
480481
volumes={str(tmp_path): {"bind": "/project", "mode": "rw"}},
481482
stream=True,
483+
entrypoint="",
482484
user=ANY,
483485
)

0 commit comments

Comments
 (0)