Skip to content

Commit 1985d3b

Browse files
[feat] update node.js version and npm packages
1 parent fc71bc3 commit 1985d3b

8 files changed

Lines changed: 349 additions & 293 deletions

File tree

.ai/AGENTS.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Always pin exact versions of base images and dependencies to ensure reproducible
2424

2525
```dockerfile
2626
# ✅ GOOD - Pinned exact version
27-
ARG NODE_VERSION=24.14.0-alpine
27+
ARG NODE_VERSION=24.15.0-alpine
2828
ARG NGINX_VERSION=1.27.3-alpine3.22
2929
FROM node:${NODE_VERSION} AS builder
3030
FROM nginxinc/nginx-unprivileged:${NGINX_VERSION} AS runner
@@ -52,7 +52,7 @@ Prefer Alpine Linux or Debian Slim variants for smaller image sizes and reduced
5252

5353
```dockerfile
5454
# ✅ GOOD - Alpine variant (smallest, ~5MB base)
55-
FROM node:24.14.0-alpine
55+
FROM node:24.15.0-alpine
5656

5757
# ✅ GOOD - Slim variant (Debian-based, ~70MB base)
5858
FROM node:24.11.1-slim
@@ -90,15 +90,15 @@ Separate build dependencies from runtime dependencies to minimize final image si
9090
```dockerfile
9191
# ✅ GOOD - Multi-stage build
9292
# Stage 1: Build
93-
FROM node:24.14.0-alpine AS builder
93+
FROM node:24.15.0-alpine AS builder
9494
WORKDIR /app
9595
COPY package.json package-lock.json ./
9696
RUN npm ci
9797
COPY . .
9898
RUN npm run build
9999

100100
# Stage 2: Runtime
101-
FROM node:24.14.0-alpine AS runner
101+
FROM node:24.15.0-alpine AS runner
102102
WORKDIR /app
103103
ENV NODE_ENV=production
104104
COPY --from=builder /app/dist ./dist
@@ -108,7 +108,7 @@ USER node
108108
CMD ["node", "server.js"]
109109

110110
# ❌ BAD - Single stage with all dependencies
111-
FROM node:24.14.0-alpine
111+
FROM node:24.15.0-alpine
112112
WORKDIR /app
113113
COPY . .
114114
RUN npm install # Includes devDependencies
@@ -139,14 +139,14 @@ Always run containers as a non-root user to minimize security risks.
139139

140140
```dockerfile
141141
# ✅ GOOD - Using built-in non-root user
142-
FROM node:24.14.0-alpine
142+
FROM node:24.15.0-alpine
143143
WORKDIR /app
144144
COPY --chown=node:node . .
145145
USER node
146146
CMD ["node", "server.js"]
147147

148148
# ✅ GOOD - Creating custom non-root user
149-
FROM node:24.14.0-alpine
149+
FROM node:24.15.0-alpine
150150
RUN addgroup -g 1001 -S nodejs && \
151151
adduser -S nodejs -u 1001
152152
WORKDIR /app
@@ -160,7 +160,7 @@ COPY --chown=nginx:nginx . /usr/share/nginx/html
160160
USER nginx
161161

162162
# ❌ BAD - Running as root
163-
FROM node:24.14.0-alpine
163+
FROM node:24.15.0-alpine
164164
WORKDIR /app
165165
COPY . .
166166
# No USER directive = runs as root
@@ -191,7 +191,7 @@ Order Dockerfile instructions from least to most frequently changing.
191191

192192
```dockerfile
193193
# ✅ GOOD - Optimal layer ordering
194-
FROM node:24.14.0-alpine AS builder
194+
FROM node:24.15.0-alpine AS builder
195195
WORKDIR /app
196196

197197
# 1. Copy dependency files first (changes infrequently)
@@ -207,7 +207,7 @@ COPY . .
207207
RUN npm run build
208208

209209
# ❌ BAD - Poor layer ordering
210-
FROM node:24.14.0-alpine
210+
FROM node:24.15.0-alpine
211211
WORKDIR /app
212212
COPY . . # Changes frequently, invalidates cache
213213
RUN npm install # Re-runs every time
@@ -289,7 +289,7 @@ services:
289289
context: .
290290
dockerfile: Dockerfile
291291
args:
292-
NODE_VERSION: 24.14.0-alpine
292+
NODE_VERSION: 24.15.0-alpine
293293
image: myapp:1.0.0
294294
container_name: myapp-prod # Unique, descriptive names
295295
ports:
@@ -422,19 +422,19 @@ coverage/
422422
FROM node:latest
423423
424424
# ✅ GOOD
425-
FROM node:24.14.0-alpine
425+
FROM node:24.15.0-alpine
426426
```
427427

428428
### 2. ❌ Running as Root
429429

430430
```dockerfile
431431
# ❌ BAD
432-
FROM node:24.14.0-alpine
432+
FROM node:24.15.0-alpine
433433
COPY . .
434434
CMD ["node", "server.js"]
435435
436436
# ✅ GOOD
437-
FROM node:24.14.0-alpine
437+
FROM node:24.15.0-alpine
438438
COPY --chown=node:node . .
439439
USER node
440440
CMD ["node", "server.js"]
@@ -468,16 +468,16 @@ COPY . .
468468

469469
```dockerfile
470470
# ❌ BAD - Single stage with all tools
471-
FROM node:24.14.0-alpine
471+
FROM node:24.15.0-alpine
472472
RUN npm install
473473
RUN npm run build
474474
CMD ["node", "server.js"]
475475
476476
# ✅ GOOD - Multi-stage
477-
FROM node:24.14.0-alpine AS builder
477+
FROM node:24.15.0-alpine AS builder
478478
RUN npm ci && npm run build
479479
480-
FROM node:24.14.0-alpine
480+
FROM node:24.15.0-alpine
481481
COPY --from=builder /app/dist ./dist
482482
RUN npm ci --only=production
483483
CMD ["node", "server.js"]
@@ -543,7 +543,7 @@ Before finalizing a Dockerfile, ensure:
543543
# =========================================
544544
# Stage 1: Build
545545
# =========================================
546-
ARG NODE_VERSION=24.14.0-alpine
546+
ARG NODE_VERSION=24.15.0-alpine
547547
548548
FROM node:${NODE_VERSION} AS builder
549549

.ai/rules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ When creating or modifying Dockerfiles, Docker Compose files, or Docker-related
66

77
- **ALWAYS** pin exact versions of base images. Never use `latest` or floating tags.
88
- Use ARG variables for versions to allow override while maintaining defaults.
9-
- Example: `ARG NODE_VERSION=24.14.0-alpine` (not `node:latest` or `node:24-alpine`)
9+
- Example: `ARG NODE_VERSION=24.15.0-alpine` (not `node:latest` or `node:24-alpine`)
1010

1111
## Base Image Selection
1212

1313
- **ALWAYS** use Alpine (`-alpine`) or Slim (`-slim`) variants for smaller images and reduced attack surface.
1414
- Prefer Alpine for Node.js applications unless glibc compatibility is required.
15-
- Example: `FROM node:24.14.0-alpine` (not `FROM node:24.11.1`)
15+
- Example: `FROM node:24.15.0-alpine` (not `FROM node:24.11.1`)
1616

1717
## Multi-Stage Builds
1818

@@ -93,7 +93,7 @@ When creating or modifying Dockerfiles, Docker Compose files, or Docker-related
9393

9494
## Project-Specific Standards
9595

96-
- Node.js version: Use `24.14.0-alpine` as the default.
96+
- Node.js version: Use `24.15.0-alpine` as the default.
9797
- Nginx version: Use `nginxinc/nginx-unprivileged:alpine3.22` for unprivileged nginx.
9898
- Serve package: Pin to `serve@14.2.5` when using Vercel serve.
9999
- Ports: Use `8080` for production, `5173` for Vite dev server.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =========================================
22
# Stage 1: Build the React.js Application
33
# =========================================
4-
ARG NODE_VERSION=24.14.0-alpine
4+
ARG NODE_VERSION=24.15.0-alpine
55
ARG NGINX_VERSION=alpine3.22
66

77
# Use a lightweight Node.js image for building (customizable via ARG)

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =========================================
22
# Stage 1: Develop the React.js Application
33
# =========================================
4-
ARG NODE_VERSION=24.14.0-alpine
4+
ARG NODE_VERSION=24.15.0-alpine
55

66
# Use a lightweight Node.js Alpine image for development
77
FROM node:${NODE_VERSION} AS dev

Dockerfile.serve

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =============================
22
# Stage 1: Build the application
33
# =============================
4-
ARG NODE_VERSION=24.11.1
4+
ARG NODE_VERSION=24.15.0
55

66
# Use a lightweight Node.js Alpine image for building
77
FROM node:${NODE_VERSION}-alpine AS build

Taskfile.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ vars:
77
HOST_PORT: 3000
88
CONTAINER_PORT: 8080
99
DOCKERFILE: Dockerfile
10-
NODE_VERSION: 24.14.0-alpine
10+
NODE_VERSION: 24.15.0-alpine
1111
NGINX_VERSION: alpine3.22
1212
NODE_ENV: production
1313

1414
tasks:
1515
build:
1616
desc: "Build the Docker image"
1717
cmds:
18-
- docker build
19-
--build-arg NODE_VERSION={{.NODE_VERSION}}
20-
--build-arg NGINX_VERSION={{.NGINX_VERSION}}
21-
-f {{.DOCKERFILE}} -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}} .
18+
- docker build --build-arg NODE_VERSION={{.NODE_VERSION}} --build-arg
19+
NGINX_VERSION={{.NGINX_VERSION}} -f {{.DOCKERFILE}} -t
20+
{{.IMAGE_NAME}}:{{.IMAGE_TAG}} .
2221

2322
run:
2423
desc: "Run the Docker container"
2524
cmds:
2625
- docker rm -f {{.CONTAINER_NAME}} 2>/dev/null
27-
- docker run -d --name {{.CONTAINER_NAME}} -p {{.HOST_PORT}}:{{.CONTAINER_PORT}} {{.IMAGE_NAME}}:{{.IMAGE_TAG}}
26+
- docker run -d --name {{.CONTAINER_NAME}} -p
27+
{{.HOST_PORT}}:{{.CONTAINER_PORT}} {{.IMAGE_NAME}}:{{.IMAGE_TAG}}
2828

2929
build-run:
3030
desc: "Build and run the Docker container in one step"

0 commit comments

Comments
 (0)