Skip to content

Commit 578509e

Browse files
[fix] minnor text issues and node.js image increase
1 parent 4cae5b3 commit 578509e

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

content/guides/nodejs/configure-github-actions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To enable GitHub Actions to build and push Docker images, you'll securely store
5050

5151
3. Create a new [GitHub repository](https://github.com/new) for your Node.js project
5252

53-
4. Add Docker Hub credentials as GitHub repository secrets
53+
4. Add Docker Hub credentials as GitHub repository secrets.
5454

5555
In your newly created GitHub repository:
5656
1. Navigate to:
@@ -66,7 +66,7 @@ To enable GitHub Actions to build and push Docker images, you'll securely store
6666

6767
These secrets let GitHub Actions to authenticate securely with Docker Hub during automated workflows.
6868

69-
5. Connect Your Local Project to GitHub
69+
5. Connect your local project to GitHub.
7070

7171
Link your local project `docker-nodejs-sample` to the GitHub repository you just created by running the following command from your project root:
7272

@@ -92,7 +92,7 @@ To enable GitHub Actions to build and push Docker images, you'll securely store
9292

9393
This confirms that your local repository is properly linked and ready to push your source code to GitHub.
9494

95-
6. Push Your Source Code to GitHub
95+
6. Push your source code to GitHub.
9696

9797
Follow these steps to commit and push your local project to your GitHub repository:
9898
1. Stage all files for commit.

content/guides/nodejs/containerize.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Containerize a Node.js Application
2+
title: Containerize a Node.js application
33
linkTitle: Containerize
44
weight: 10
55
keywords: node.js, node, containerize, initialize
@@ -81,7 +81,7 @@ For consistency, use the same responses shown in the example following when prom
8181
| Question | Answer |
8282
|------------------------------------------------------------|-----------------|
8383
| What application platform does your project use? | Node |
84-
| What version of Node do you want to use? | 22.21.0-alpine3.21 |
84+
| What version of Node do you want to use? | 24.11.1-alpine |
8585
| Which package manager do you want to use? | npm |
8686
| Do you want to run "npm run build" before starting server? | yes |
8787
| What directory is your build output to? | dist |
@@ -297,9 +297,9 @@ ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173
297297

298298
The default Dockerfile generated by `docker init` provides a reliable baseline for standard Node.js applications. However, since this project is a full-stack TypeScript application that includes both a backend API and frontend React components, the Dockerfile should be customized to better support and optimize this specific architecture.
299299

300-
### Step 1: Review the generated files
300+
### Review the generated files
301301

302-
In this step, you’ll improve the Dockerfile and configuration files by following best practices:
302+
In the following step, you’ll improve the Dockerfile and configuration files by following best practices:
303303

304304
- Use multi-stage builds to keep the final image clean and small
305305
- Improve performance and security by only including what’s needed
@@ -310,25 +310,30 @@ These updates help ensure your app is easy to deploy, fast to load, and producti
310310
> A `Dockerfile` is a plain text file that contains step-by-step instructions to build a Docker image. It automates packaging your application along with its dependencies and runtime environment.
311311
> For full details, see the [Dockerfile reference](/reference/dockerfile/).
312312

313-
### Step 2: Configure the Dockerfile file
313+
### Step 1: Configure the Dockerfile
314314

315315
Before creating a Dockerfile, you need to choose a base image. You can either use the [Node.js Official Image](https://hub.docker.com/_/node) or a Docker Hardened Image (DHI) from the [Hardened Image catalog](https://hub.docker.com/hardened-images/catalog).
316316

317317
Choosing DHI offers the advantage of a production-ready image that is lightweight and secure. For more information, see [Docker Hardened Images](https://docs.docker.com/dhi/).
318318

319+
> [!IMPORTANT]
320+
> This guide uses a stable Node.js LTS image tag that is considered secure when the guide is written. Because new releases and security patches are published regularly, the tag shown here may no longer be the safest option when you follow the guide. Always review the latest available image tags and select a secure, up-to-date version before building or deploying your application.
321+
>
322+
> Official Node.js Docker Images: https://hub.docker.com/_/node
323+
319324
{{< tabs >}}
320325
{{< tab name="Using Docker Hardened Images" >}}
321326
Docker Hardened Images (DHIs) are available for Node.js on [Docker Hub](https://hub.docker.com/hardened-images/catalog/dhi/node). Unlike using the Docker Official Image, you must first mirror the Node.js image into your organization and then use it as your base image. Follow the instructions in the [DHI quickstart](/dhi/get-started/) to create a mirrored repository for Node.js.
322327

323-
Mirrored repositories must start with `dhi-`, for example: `FROM <your-namespace>/dhi-node:<tag>`. In the following Dockerfile, the `FROM` instruction uses `<your-namespace>/dhi-node:22` as the base image.
328+
Mirrored repositories must start with `dhi-`, for example: `FROM <your-namespace>/dhi-node:<tag>`. In the following Dockerfile, the `FROM` instruction uses `<your-namespace>/dhi-node:24-alpine3.22-dev` as the base image.
324329

325330
```dockerfile
326331
# ========================================
327332
# Optimized Multi-Stage Dockerfile
328333
# Node.js TypeScript Application (Using DHI)
329334
# ========================================
330335
331-
FROM <your-namespace>/dhi-node:22 AS base
336+
FROM <your-namespace>/dhi-node:24-alpine3.22-dev AS base
332337
333338
# Set working directory
334339
WORKDIR /app
@@ -414,8 +419,7 @@ CMD ["npm", "run", "dev:docker"]
414419
# ========================================
415420
# Production Stage
416421
# ========================================
417-
ARG NODE_VERSION=22.21.0-alpine3.21
418-
FROM node:${NODE_VERSION} AS production
422+
FROM <your-namespace>/dhi-node:24-alpine3.22-dev AS production
419423
420424
# Set working directory
421425
WORKDIR /app
@@ -465,7 +469,7 @@ CMD ["npm", "run", "test:coverage"]
465469
```
466470

467471
{{< /tab >}}
468-
{{< tab name="Using the official Docker image" >}}
472+
{{< tab name="Using the Docker Official Image" >}}
469473

470474
Now you need to create a production-ready multi-stage Dockerfile. Replace the generated Dockerfile with the following optimized configuration:
471475

@@ -475,7 +479,7 @@ Now you need to create a production-ready multi-stage Dockerfile. Replace the ge
475479
# Node.js TypeScript Application
476480
# ========================================
477481
478-
ARG NODE_VERSION=22.21.0-alpine3.21
482+
ARG NODE_VERSION=24.11.1-alpine
479483
FROM node:${NODE_VERSION} AS base
480484
481485
# Set working directory
@@ -562,7 +566,7 @@ CMD ["npm", "run", "dev:docker"]
562566
# ========================================
563567
# Production Stage
564568
# ========================================
565-
ARG NODE_VERSION=22.21.0-alpine3.21
569+
ARG NODE_VERSION=24.11.1-alpine
566570
FROM node:${NODE_VERSION} AS production
567571
568572
# Set working directory

0 commit comments

Comments
 (0)