diff --git a/samcli/local/docker/lambda_build_container.py b/samcli/local/docker/lambda_build_container.py index b1e3d23077..8952328182 100644 --- a/samcli/local/docker/lambda_build_container.py +++ b/samcli/local/docker/lambda_build_container.py @@ -22,7 +22,7 @@ class LambdaBuildContainer(Container): and if the build was successful, copies back artifacts to the host filesystem """ - _IMAGE_REPO_NAME = "lambci/lambda" + _LAMBCI_IMAGE_REPO_NAME = "lambci/lambda" _BUILDERS_EXECUTABLE = "lambda-builders" def __init__(self, # pylint: disable=too-many-locals @@ -229,4 +229,7 @@ def _convert_to_container_dirs(host_paths_to_convert, host_to_container_path_map @staticmethod def _get_image(runtime): - return "{}:build-{}".format(LambdaBuildContainer._IMAGE_REPO_NAME, runtime) + runtime_to_images = {"nodejs10.x": "amazon/lambda-build-node10.x"} + + return runtime_to_images.get(runtime, + "{}:build-{}".format(LambdaBuildContainer._LAMBCI_IMAGE_REPO_NAME, runtime)) diff --git a/tests/unit/local/docker/test_lambda_build_container.py b/tests/unit/local/docker/test_lambda_build_container.py index edda1db09f..f51e8589be 100644 --- a/tests/unit/local/docker/test_lambda_build_container.py +++ b/tests/unit/local/docker/test_lambda_build_container.py @@ -8,10 +8,11 @@ except ImportError: import pathlib2 as pathlib - from unittest import TestCase from mock import patch +from parameterized import parameterized + from samcli.local.docker.lambda_build_container import LambdaBuildContainer @@ -157,8 +158,12 @@ def test_must_override_manifest_if_equal_to_source(self): class TestLambdaBuildContainer_get_image(TestCase): - def test_must_get_image_name(self): - self.assertEquals("lambci/lambda:build-myruntime", LambdaBuildContainer._get_image("myruntime")) + @parameterized.expand([ + ("myruntime", "lambci/lambda:build-myruntime"), + ("nodejs10.x", "amazon/lambda-build-node10.x") + ]) + def test_must_get_image_name(self, runtime, expected_image_name): + self.assertEquals(expected_image_name, LambdaBuildContainer._get_image(runtime)) class TestLambdaBuildContainer_get_entrypoint(TestCase):