File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,10 @@ build
239239node_modules
240240```
241241
242+ > [ !NOTE]
243+ > We're makeing sure that no matter where we're building the image it never loads in any built files or local ` node_modules ` .
244+ > That way, whenever we're building it is done in an identical way and reduces the possibility of "it worked on my machine".
245+
242246### Update ` Dockerfile `
243247
244248Update ` nodejs/Dockerfile ` :
@@ -257,6 +261,35 @@ RUN npm run build
257261CMD [ "build/index.handler" ]
258262```
259263
264+ > [ !NOTE]
265+ > As we're now doing the dependency install as part of the build, when you run ` docker images ` you'll notice our Docker image has increased in size.
266+ >
267+ > ``` shell
268+ > $ docker images
269+ > REPOSITORY TAG IMAGE ID CREATED SIZE
270+ > your-lambda latest 05b92630088f 3 seconds ago 483MB
271+ > public.ecr.aws/lambda/nodejs 24 30d41baede74 3 days ago 449MB
272+ > ` ` `
273+
274+ > [! TIP]
275+ > When running ` docker images` you' ll notice that we have got a dangling image that looks a bit like this:
276+ >
277+ > ```shell
278+ > $ docker images
279+ > REPOSITORY TAG IMAGE ID CREATED SIZE
280+ > your-lambda latest 05b92630088f 3 seconds ago 483MB
281+ > public.ecr.aws/lambda/nodejs 24 30d41baede74 3 days ago 449MB
282+ > <none> <none> 17e6c55f785f 3 days ago 449MB
283+ > ```
284+ >
285+ > When you rebuilt the image, Docker moved the "nametag" to your new version, leaving the old version behind as a nameless orphan.
286+ >
287+ > Any dangling images can be cleaned with the following command:
288+ >
289+ > ```shell
290+ > docker image prune
291+ > ```
292+
260293### Update Lambda healthcheck
261294
262295Update `docker-compose.yaml`:
You can’t perform that action at this time.
0 commit comments