diff --git a/examples/build-package/main.tf b/examples/build-package/main.tf index 61dd0102..42afe7ca 100644 --- a/examples/build-package/main.tf +++ b/examples/build-package/main.tf @@ -219,8 +219,8 @@ module "package_with_docker" { docker_pip_cache = true docker_with_ssh_agent = true # docker_file = "${path.module}/../fixtures/python3.8-app1/docker/Dockerfile" - docker_build_root = "${path.module}/../../docker" - docker_image = "public.ecr.aws/sam/build-python3.8" + docker_build_root = "${path.module}/../fixtures/python3.8-app1/docker" + docker_image = "public.ecr.aws/sam/build-python3.8:latest" } # Create zip-archive of a single directory where "npm install" will also be executed (default for nodejs runtime) @@ -278,7 +278,7 @@ module "lambda_layer" { build_in_docker = true runtime = "python3.8" - docker_image = "public.ecr.aws/sam/build-python3.8" + docker_image = "public.ecr.aws/sam/build-python3.8:latest" docker_file = "${path.module}/../fixtures/python3.8-app1/docker/Dockerfile" } diff --git a/package.py b/package.py index 79b2ea67..02b105cf 100644 --- a/package.py +++ b/package.py @@ -649,6 +649,7 @@ def plan(self, source_path, query): hash = source_paths.append def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None): + command = runtime requirements = path if os.path.isdir(path): requirements = os.path.join(path, 'requirements.txt') @@ -657,16 +658,17 @@ def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None): raise RuntimeError( 'File not found: {}'.format(requirements)) else: - if not query.docker and not shutil.which(runtime): + if not query.docker and not shutil.which(command): raise RuntimeError( "Python interpreter version equal " "to defined lambda runtime ({}) should be " - "available in system PATH".format(runtime)) + "available in system PATH".format(command)) step('pip', runtime, requirements, prefix, tmp_dir) hash(requirements) def npm_requirements_step(path, prefix=None, required=False, tmp_dir=None): + command = "npm" requirements = path if os.path.isdir(path): requirements = os.path.join(path, 'package.json') @@ -675,11 +677,10 @@ def npm_requirements_step(path, prefix=None, required=False, tmp_dir=None): raise RuntimeError( 'File not found: {}'.format(requirements)) else: - if not query.docker and not shutil.which(runtime): + if not query.docker and not shutil.which(command): raise RuntimeError( - "Nodejs interpreter version equal " - "to defined lambda runtime ({}) should be " - "available in system PATH".format(runtime)) + "Nodejs package manager ({}) should be " + "available in system PATH".format(command)) step('npm', runtime, requirements, prefix, tmp_dir) hash(requirements)