aws / aws/aws-lambda-base-images

What even is this?

Open
#7 5 comments 18 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
777
Forks
118
PR merge metrics
No merged PRs in 30d

Description

I've deleted the less kind words I initially wrote. Please can you read the comments below and look at addressing how you organise this repo.

*Organising images by branch*

This is the first time I've ever seen a repo organised by branch per project. Effectively this is a monorepo organised by branch. The branch per image thing is confusing at a minimum, but the monorepo aspect presents more challenges.

If someone wants to fork it to contribute back or clone it to use as a base to make their own image. Due to this being a repo of base images, you end up forking/cloning all of them. It would be far better to have a repo per image as the majority of folks forking or cloning would only ever use 1 image.

What is the process guideline for contributing back with this image?

*Building the base image from tar files*

You build the base image from tar files, which are based on Lambda Layers from my understanding. This means for me to understand what is in the docker image I have to clone the repo locally and untar the images. If I want to contribute back do I need to then rebuild that tar and include it in the repo? Or do I find a repo with the layer? Does a separate repo with these layers exist? How do you inspect changes and review PR's like that? You can't effectively handle contributions back when the base image is a set of tar files

*Insecure Images and unneeded dependencies*

I've just tried to build a Lambda Node.js container image, and while it completed successfully it spewed out a bunch of node.js errors, listed below

```

Sending build context to Docker daemon 950.8kB
Step 1/4 : FROM public.ecr.aws/lambda/nodejs:12
---> 9549f0a87034
Step 2/4 : COPY **/*.js **/*.json ./
---> 5753c7880774
Step 3/4 : RUN npm install
---> Running in 21b48a29cd7b
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

> node-sass@4.14.1 install /var/task/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
Download complete
Binary saved to /var/task/node_modules/node-sass/vendor/linux-x64-72/binding.node
Caching binary to /root/.npm/node-sass/4.14.1/linux-x64-72_binding.node

> husky@4.3.8 install /var/task/node_modules/husky
> node husky install

husky > Setting up git hooks
git --version command failed. Got null.
husky > Failed to install

> core-js@3.8.3 postinstall /var/task/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> node-sass@4.14.1 postinstall /var/task/node_modules/node-sass
> node scripts/build.js

Binary found at /var/task/node_modules/node-sass/vendor/linux-x64-72/binding.node
Testing binary
Binary is fine

> husky@4.3.8 postinstall /var/task/node_modules/husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate

> vuepress@1.8.0 postinstall /var/task/node_modules/vuepress
> opencollective-postinstall || exit 0

Thank you for using vuepress!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/vuepress/donate

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/rollup/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@vuepress/core/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 2119 packages from 1636 contributors and audited 2127 packages in 50.811s

92 packages are looking for funding
run `npm fund` for details

found 4 high severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
```

Why are all of these unneeded modules being installed? I don't understand why my Lambda container now has `Vuepress` installed? What is using `request` that has been deprecated by it's authors? How do I fix or even evaluate the 4 high severity vulnerabilities highlight by the `npm install` process??

You do realise this will set off all kinds of security alarms when scanned by vendors, and leave your users having to explain to security teams why they're bringing an insecure container into their environment. When you surface partial information to users (ie through npm logs), you need to be able to provide the answers to the questions this information raises, or else you will erode trust.

Yes, this might all be safe because these deps get jettisoned or not used when run in Lambda, but 'trust us' isn't an answer, allow us to verify it, and allow us to fork and build a minimal version without unused deps if need be.

*How do I make this simple change?*

Coming back to why I originally came to this repo. I want to run a Lambda container using Node.js with more than memory than Node.js has access to by default to take advantage of the 10GB of memory available to Lambda now. To do this I need to start node with a simple feature flag. I am assuming somewhere in `lambda-entrypoint.sh` is the command to start Node.

All I want to do is clone the repo, add `--max-old-space-size=8192` to the `node` command in `lamdba-entrypoint.sh`. Where do I even start with this bonkers and opaque way of laying out this repo. I'm trying to add 26 characters to a single line. How do I do this?

My recommendation is this...

- Move each base image to it's own repo. This will allow folks to fork and clone just the repo they need, either to contribute back, or to create their own versions of the image for their own purposes.
- Put all layer code into those singular repos, or make them available in separate repos, don't hide them in tar files.

Where is the Customer Obession? Where is Simplify in Invent & Simply? Where are you Insisting on the Highest Standards?

Please stop building for yourselves. Build for us, your customers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.