Skip to content

Commit f77794b

Browse files
committed
build(docker): add caged image variant
1 parent c3f4dad commit f77794b

8 files changed

Lines changed: 82 additions & 8 deletions

File tree

.dockerignore

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
node_modules/
2+
.git/
23
.github/
34
.nitro/
45
.output/
56
.vscode/
67
data/
78
.env*
89
.eslintcache
9-
test/
10-
certs/
10+
tests/
11+
certs/
12+
install/
13+
benchmark.ts
14+
docker-compose.yml
15+
vitest.config.ts
16+
prettier.config.js
17+
eslint.config.js
18+
README.md
19+
LICENSE

.github/workflows/ci-cd.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,23 @@ jobs:
104104
labels: ${{ steps.meta.outputs.labels }}
105105
build-args: |
106106
BUILD_HASH=${{ steps.build_hash.outputs.COMMIT_SHA }}
107+
108+
- name: Extract metadata (tags, labels) for Docker (caged)
109+
id: meta-caged
110+
uses: docker/metadata-action@v5
111+
with:
112+
images: ghcr.io/${{ github.repository }}
113+
tags: |
114+
dev-caged
115+
116+
- name: Build and push (caged)
117+
uses: docker/build-push-action@v6
118+
with:
119+
context: .
120+
platforms: linux/amd64,linux/arm64
121+
push: true
122+
tags: ${{ steps.meta-caged.outputs.tags }}
123+
labels: ${{ steps.meta-caged.outputs.labels }}
124+
build-args: |
125+
BUILD_HASH=${{ steps.build_hash.outputs.COMMIT_SHA }}
126+
BASE_IMAGE=platformatic/node-caged:25-alpine

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,29 @@ jobs:
137137
tags: ${{ steps.meta.outputs.tags }}
138138
labels: ${{ steps.meta.outputs.labels }}
139139

140+
- name: Extract metadata (tags, labels) for Docker (caged)
141+
id: meta-caged
142+
uses: docker/metadata-action@v5
143+
with:
144+
images: ghcr.io/${{ github.repository }}
145+
tags: |
146+
type=semver,pattern={{version}}-caged,value=${{ needs.release.outputs.RELEASE_TAG }}
147+
type=semver,pattern={{major}}.{{minor}}-caged,value=${{ needs.release.outputs.RELEASE_TAG }}
148+
type=semver,pattern={{major}}-caged,value=${{ needs.release.outputs.RELEASE_TAG }}
149+
latest-caged
150+
dev-caged
151+
152+
- name: Build and push (caged)
153+
uses: docker/build-push-action@v6
154+
with:
155+
context: .
156+
push: true
157+
platforms: linux/amd64,linux/arm64
158+
tags: ${{ steps.meta-caged.outputs.tags }}
159+
labels: ${{ steps.meta-caged.outputs.labels }}
160+
build-args: |
161+
BASE_IMAGE=platformatic/node-caged:25-alpine
162+
140163
deploy-chart:
141164
name: 🚀 Build and push Helm chart
142165
permissions:

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
FROM node:24-alpine AS builder
1+
ARG BASE_IMAGE=node:25-alpine
2+
3+
FROM ${BASE_IMAGE} AS builder
24

35
WORKDIR /app
46

5-
RUN npm install -g pnpm@latest-10
7+
RUN --mount=type=cache,target=/root/.npm npm install -g pnpm@latest-10
68

79
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
811
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm fetch --prod
12+
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile --prod --offline
913

1014
COPY . .
11-
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile --prod --offline
1215

1316
ARG BUILD_HASH
1417
ENV BUILD_HASH=${BUILD_HASH}
1518
RUN pnpm run build
1619

1720
# --------------------------------------------
1821

19-
FROM node:24-alpine AS runner
22+
FROM ${BASE_IMAGE} AS runner
2023

2124
ENV NITRO_CLUSTER_WORKERS=1
2225

install/kubernetes/github-actions-cache-server/templates/NOTES.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@ GitHub Actions Cache Server has been deployed!
99
API URL: {{ .Values.config.apiBaseUrl }}
1010
{{- end }}
1111

12+
{{- if eq (.Values.image.variant | default "") "caged" }}
13+
14+
⚠️ EXPERIMENTAL: You are using the "caged" image variant (V8 pointer compression).
15+
Each V8 isolate is limited to a 4 GB heap.
16+
Test in staging first and monitor memory/latency.
17+
More info: https://blog.platformatic.dev/we-cut-nodejs-memory-in-half
18+
{{- end }}
19+
1220
Docs: https://gha-cache-server.falcondev.io/getting-started

install/kubernetes/github-actions-cache-server/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
- name: {{ .Chart.Name }}
4242
securityContext:
4343
{{- toYaml .Values.securityContext | nindent 12 }}
44-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
44+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}{{ if .Values.image.variant }}-{{ .Values.image.variant }}{{ end }}"
4545
imagePullPolicy: {{ .Values.image.pullPolicy }}
4646
ports:
4747
- name: cache

install/kubernetes/github-actions-cache-server/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ image:
99
pullPolicy: IfNotPresent
1010
# Overrides the image tag whose default is the chart appVersion.
1111
tag: ''
12+
# -- (experimental) Image variant to use. Set to "caged" to use the platformatic/node-caged
13+
# based image, which enables V8 pointer compression for ~50% lower memory usage.
14+
# See: https://blog.platformatic.dev/we-cut-nodejs-memory-in-half
15+
#
16+
# Caveats:
17+
# - Each V8 isolate is limited to a 4 GB heap. Not suitable for workloads that
18+
# require more than 4 GB per isolate.
19+
# - Expect ~2-4% higher average latency, though p99/max latency may improve due
20+
# to reduced GC pressure.
21+
# When set, "-caged" is appended to the resolved image tag.
22+
variant: ''
1223

1324
imagePullSecrets: []
1425
nameOverride: ''

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "9.2.0",
55
"private": true,
66
"engines": {
7-
"node": "24",
7+
"node": "25",
88
"pnpm": "10"
99
},
1010
"scripts": {

0 commit comments

Comments
 (0)