Skip to content

lambda-nodejs: Support additional arguments from user and environments when building the builder and running builder container #8117

@zxkane

Description

@zxkane

Since moving to use docker container to build the source of lambda-nodejs, the users might have problem to downloading the dependencies in docker build.

Use Case

When I synthesis/deploy a CDK app with lambda-nodejs code in China. I failed to build the source code of lambda-nodejs due to network issue in Docker container.

See error message below,

Failed to build file at /path/assets/ecs-task-def/ecs.ts: Error: [Status 1] stdout: Sending build context to Docker daemon  2.048kB
Step 1/5 : ARG NODE_TAG
Step 2/5 : FROM node:${NODE_TAG}
 ---> 87c43f8d8077
Step 3/5 : RUN yarn global add parcel-bundler@^1
 ---> Running in 29b5567d211a
yarn global v1.22.4
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/parcel-bundler: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/usr/local/share/.config/yarn/global/yarn-error.log".

Actually I can install the dependencies manually via proxy server in earlier CDK versions.

Proposed Solution

Docker build supports specifying build arguments about proxy like below,

docker build --build-arg HTTP_PROXY=$http_proxy \
--build-arg HTTPS_PROXY=$http_proxy

docker run --env HTTP_PROXY=$http_proxy \
--env HTTPS_PROXY=$http_proxy

Add a capability to support the user specifying the builder arguments or directly passing the proxy arguments if they are set in env.

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions