Skip to content

Commit ff06954

Browse files
committed
Update README.md
1 parent 32d35e0 commit ff06954

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ build
239239
node_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

244248
Update `nodejs/Dockerfile`:
@@ -257,6 +261,35 @@ RUN npm run build
257261
CMD [ "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
262295
Update `docker-compose.yaml`:

0 commit comments

Comments
 (0)