feature/ci-cd #80

Merged
rameen merged 6 commits from feature/ci-cd into master 2026-09-15 08:37:08 +03:30
8 changed files with 649 additions and 625 deletions

View File

@@ -101,7 +101,7 @@ jobs:
$pass.Trim() | docker login "${{ vars.REGISTRY_HOST }}" -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Resolve node:20-alpine (Gitea, then mirrors, Hub last)
- name: Resolve node:20-bookworm-slim (Gitea, then mirrors, Hub last)
run: |
$ErrorActionPreference = 'Stop'
$prefix = "${{ vars.REGISTRY_HOST }}/${{ vars.REGISTRY_OWNER }}".Trim()
@@ -223,8 +223,13 @@ jobs:
$keyPath = Join-Path $env:RUNNER_TEMP 'prod_ssh'
$normalized = $key.Replace("`r`n", "`n").TrimEnd() + "`n"
[System.IO.File]::WriteAllText($keyPath, $normalized)
icacls $keyPath /inheritance:r | Out-Null
icacls $keyPath /grant:r "$($env:USERNAME):(R)" | Out-Null
# act_runner as Network Service/SYSTEM sets USERNAME to HOST$ — icacls cannot map that.
# Grant by SID so OpenSSH accepts the private-key ACL on a service account.
$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
icacls $keyPath /inheritance:r
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
icacls $keyPath /grant:r "*${sid}:(R)"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "PROD_SSH_KEY_PATH=$keyPath`n")
- name: Copy compose + deploy script to Linux

View File

@@ -18,7 +18,7 @@
# STAGING_LOCAL_PORT Docker bind on 127.0.0.1 (default 18088) — must not equal the public port if portproxy owns it
# CLONE_HOST git clone host when runner = Gitea host → 127.0.0.1:3000
# NODE_IMAGE_SOURCE extra base-image ref(s), comma-separated, tried before built-in mirrors
# e.g. docker.arvancloud.ir/library/node:20-alpine
# e.g. docker.arvancloud.ir/library/node:20-bookworm-slim
#
# Same Windows PC runs Gitea + runner + deploy:
# CLONE_HOST → 127.0.0.1:3000 (git runs on Windows host)
@@ -86,7 +86,7 @@ jobs:
$pass.Trim() | docker login "${{ vars.REGISTRY_HOST }}" -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Resolve node:20-alpine (Gitea, then mirrors, Hub last)
- name: Resolve node:20-bookworm-slim (Gitea, then mirrors, Hub last)
run: |
$ErrorActionPreference = 'Stop'
$prefix = "${{ vars.REGISTRY_HOST }}/${{ vars.REGISTRY_OWNER }}".Trim()

View File

@@ -1,5 +1,5 @@
# CI can pass a Gitea-hosted mirror when Docker Hub TLS fails (see ci-resolve-node-image.ps1).
ARG NODE_IMAGE=node:20-alpine
ARG NODE_IMAGE=node:20-bookworm-slim
# ============================================
# STAGE 1: BUILDER STAGE
@@ -12,16 +12,23 @@ COPY package*.json ./
COPY .npmrc ./
COPY prisma ./prisma/
# npm ci can exit 0 on some Docker Desktop setups while leaving node_modules/.bin
# empty ("Exit handler never called!") — then `prisma` / `nest` are "not found".
RUN npm ci --no-audit --no-fund || true; \
if [ ! -e node_modules/.bin/prisma ] || [ ! -e node_modules/.bin/nest ]; then \
echo "Incomplete npm ci (missing .bin links) — falling back to npm install"; \
rm -rf node_modules; \
npm install --no-audit --no-fund; \
fi; \
test -e node_modules/.bin/prisma; \
test -e node_modules/.bin/nest
# Debian bookworm-slim (glibc). Single npm ci + BuildKit cache (no nested retries).
# Staging runners that flake on registry.npmjs.org (ETIMEDOUT / ECONNRESET) surface
# as "Exit handler never called!". Point npm + lockfile tarball hosts at
# registry.npmjs.com for this build only — does not change package-lock.json in git.
ENV NODE_OPTIONS=--max-old-space-size=3072
RUN --mount=type=cache,target=/root/.npm \
npm config set registry https://registry.npmjs.com \
&& npm config set fetch-retries 5 \
&& npm config set fetch-retry-maxtimeout 120000 \
&& npm config set maxsockets 5 \
&& sed -i \
-e 's|https://registry.npmmirror.com/|https://registry.npmjs.com/|g' \
-e 's|https://registry.npmjs.org/|https://registry.npmjs.com/|g' \
package-lock.json \
&& npm ci --no-audit --no-fund \
&& test -e node_modules/.bin/prisma \
&& test -e node_modules/.bin/nest
COPY . .
@@ -35,12 +42,14 @@ RUN npm prune --omit=dev
# ============================================
FROM ${NODE_IMAGE}
RUN apk add --no-cache dumb-init
RUN apt-get update \
&& apt-get install -y --no-install-recommends dumb-init \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN addgroup -g 1001 -S nodejs && \
adduser -S dyolink -u 1001
RUN groupadd --system --gid 1001 nodejs \
&& useradd --system --uid 1001 --gid nodejs --home-dir /app --shell /usr/sbin/nologin dyolink
# Prisma client comes from the builder (npm prune --production keeps @prisma/client).
COPY package*.json ./

View File

@@ -4486,7 +4486,7 @@
},
"node_modules/@nestjs/platform-socket.io": {
"version": "11.1.28",
"resolved": "https://registry.npmmirror.com/@nestjs/platform-socket.io/-/platform-socket.io-11.1.28.tgz",
"resolved": "https://registry.npmjs.org/@nestjs/platform-socket.io/-/platform-socket.io-11.1.28.tgz",
"integrity": "sha512-vY+GmU2jBcymvgm5rEnftUx4qNxK8cDJmXjl1/1NcpITTNJo0vg07xYR43MwXHcMqe7b0jwqt5+UCTzxqQFIqA==",
"license": "MIT",
"dependencies": {
@@ -4600,7 +4600,7 @@
},
"node_modules/@nestjs/websockets": {
"version": "11.1.28",
"resolved": "https://registry.npmmirror.com/@nestjs/websockets/-/websockets-11.1.28.tgz",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-11.1.28.tgz",
"integrity": "sha512-jeyclAURCJTN8S8lctDhfLdiJeDKjZmYWWLav653Fb9hl9c+zx5jPhavI8Xk5++R8u+lX9qzaRxtsjEoxTtjyw==",
"license": "MIT",
"dependencies": {
@@ -4901,7 +4901,7 @@
},
"node_modules/@remirror/core-constants": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/@remirror/core-constants/-/core-constants-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/@remirror/core-constants/-/core-constants-3.0.0.tgz",
"integrity": "sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==",
"license": "MIT"
},
@@ -5608,7 +5608,7 @@
},
"node_modules/@socket.io/component-emitter": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==",
"license": "MIT"
},
@@ -5749,7 +5749,7 @@
},
"node_modules/@tiptap/core": {
"version": "2.27.2",
"resolved": "https://registry.npmmirror.com/@tiptap/core/-/core-2.27.2.tgz",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.27.2.tgz",
"integrity": "sha512-ABL1N6eoxzDzC1bYvkMbvyexHacszsKdVPYqhl5GwHLOvpZcv9VE9QaKwDILTyz5voCA0lGcAAXZp+qnXOk5lQ==",
"license": "MIT",
"funding": {
@@ -6158,7 +6158,7 @@
},
"node_modules/@tiptap/pm": {
"version": "2.27.2",
"resolved": "https://registry.npmmirror.com/@tiptap/pm/-/pm-2.27.2.tgz",
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-2.27.2.tgz",
"integrity": "sha512-kaEg7BfiJPDQMKbjVIzEPO3wlcA+pZb2tlcK9gPrdDnEFaec2QTF1sXz2ak2IIb2curvnIrQ4yrfHgLlVA72wA==",
"license": "MIT",
"dependencies": {
@@ -6382,7 +6382,7 @@
},
"node_modules/@types/cors": {
"version": "2.8.19",
"resolved": "https://registry.npmmirror.com/@types/cors/-/cors-2.8.19.tgz",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz",
"integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==",
"license": "MIT",
"dependencies": {
@@ -6559,7 +6559,7 @@
},
"node_modules/@types/multer": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/@types/multer/-/multer-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/@types/multer/-/multer-2.1.0.tgz",
"integrity": "sha512-zYZb0+nJhOHtPpGDb3vqPjwpdeGlGC157VpkqNQL+UU2qwoacoQ7MpsAmUptI/0Oa127X32JzWDqQVEXp2RcIA==",
"dev": true,
"license": "MIT",
@@ -6707,7 +6707,7 @@
},
"node_modules/@types/ws": {
"version": "8.18.1",
"resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.18.1.tgz",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
"license": "MIT",
"dependencies": {
@@ -8187,7 +8187,7 @@
},
"node_modules/base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/base64id/-/base64id-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
"license": "MIT",
"engines": {
@@ -9342,7 +9342,7 @@
},
"node_modules/engine.io": {
"version": "6.6.9",
"resolved": "https://registry.npmmirror.com/engine.io/-/engine.io-6.6.9.tgz",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.9.tgz",
"integrity": "sha512-clKkw4C7nJ22mGgoVcCg6V/W/TxdNyIOTr89k2ONZu81qqkddPFDF0LXcbAwhzPD8DjkiRCjzuiO6Y+fkpD4vg==",
"license": "MIT",
"dependencies": {
@@ -9363,7 +9363,7 @@
},
"node_modules/engine.io-parser": {
"version": "5.2.3",
"resolved": "https://registry.npmmirror.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
"integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==",
"license": "MIT",
"engines": {
@@ -9372,7 +9372,7 @@
},
"node_modules/engine.io/node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"license": "MIT",
"dependencies": {
@@ -9385,7 +9385,7 @@
},
"node_modules/engine.io/node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
@@ -9394,7 +9394,7 @@
},
"node_modules/engine.io/node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
@@ -9406,7 +9406,7 @@
},
"node_modules/engine.io/node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"license": "MIT",
"engines": {
@@ -12789,7 +12789,7 @@
},
"node_modules/multer": {
"version": "2.1.1",
"resolved": "https://registry.npmmirror.com/multer/-/multer-2.1.1.tgz",
"resolved": "https://registry.npmjs.org/multer/-/multer-2.1.1.tgz",
"integrity": "sha512-mo+QTzKlx8R7E5ylSXxWzGoXoZbOsRMpyitcht8By2KHvMbf3tjwosZ/Mu/XYU6UuJ3VZnODIrak5ZrPiPyB6A==",
"license": "MIT",
"dependencies": {
@@ -13031,7 +13031,7 @@
},
"node_modules/object-hash": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/object-hash/-/object-hash-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
"integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==",
"license": "MIT",
"engines": {
@@ -13929,7 +13929,7 @@
},
"node_modules/prosemirror-trailing-node": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/prosemirror-trailing-node/-/prosemirror-trailing-node-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/prosemirror-trailing-node/-/prosemirror-trailing-node-3.0.0.tgz",
"integrity": "sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ==",
"license": "MIT",
"dependencies": {
@@ -14912,7 +14912,7 @@
},
"node_modules/socket.io": {
"version": "4.8.3",
"resolved": "https://registry.npmmirror.com/socket.io/-/socket.io-4.8.3.tgz",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.3.tgz",
"integrity": "sha512-2Dd78bqzzjE6KPkD5fHZmDAKRNe3J15q+YHDrIsy9WEkqttc7GY+kT9OBLSMaPbQaEd0x1BjcmtMtXkfpc+T5A==",
"license": "MIT",
"dependencies": {
@@ -14930,7 +14930,7 @@
},
"node_modules/socket.io-adapter": {
"version": "2.5.8",
"resolved": "https://registry.npmmirror.com/socket.io-adapter/-/socket.io-adapter-2.5.8.tgz",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.8.tgz",
"integrity": "sha512-6Oy52pbg+kvdCVvjcN+FnY7BvxZ7cIHNScbvztT/It5d0vbwoJoVZmF2gjJmnV0/4WlXRfG15zc45ySk9Ah8bw==",
"license": "MIT",
"dependencies": {
@@ -14940,7 +14940,7 @@
},
"node_modules/socket.io-parser": {
"version": "4.2.7",
"resolved": "https://registry.npmmirror.com/socket.io-parser/-/socket.io-parser-4.2.7.tgz",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.7.tgz",
"integrity": "sha512-IH/iSeO9T6gz1KkFleGDWkG9N3dl4jXVYUtMhIqH10Md0ttMer8nUNWiP1DKuNrybD2xBrixLJdCC9J6ECoYkg==",
"license": "MIT",
"dependencies": {
@@ -14953,7 +14953,7 @@
},
"node_modules/socket.io/node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"license": "MIT",
"dependencies": {
@@ -14966,7 +14966,7 @@
},
"node_modules/socket.io/node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
@@ -14975,7 +14975,7 @@
},
"node_modules/socket.io/node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
@@ -14987,7 +14987,7 @@
},
"node_modules/socket.io/node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"license": "MIT",
"engines": {
@@ -16751,7 +16751,7 @@
},
"node_modules/ws": {
"version": "8.21.1",
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.21.1.tgz",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz",
"integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==",
"license": "MIT",
"engines": {

View File

@@ -1,5 +1,5 @@
# CI can pass a Gitea-hosted mirror when Docker Hub TLS fails (see ci-resolve-node-image.ps1).
ARG NODE_IMAGE=node:20-alpine
ARG NODE_IMAGE=node:20-bookworm-slim
# Build stage — produces `.next/standalone` (see next.config.ts output: standalone)
FROM ${NODE_IMAGE} AS builder
@@ -7,14 +7,20 @@ FROM ${NODE_IMAGE} AS builder
WORKDIR /app
COPY package*.json ./
# Same safeguard as backend: incomplete npm ci can leave node_modules/.bin empty.
RUN npm ci --no-audit --no-fund || true; \
if [ ! -e node_modules/.bin/next ]; then \
echo "Incomplete npm ci (missing .bin links) — falling back to npm install"; \
rm -rf node_modules; \
npm install --no-audit --no-fund; \
fi; \
test -e node_modules/.bin/next
# Same as backend: bookworm-slim + single npm ci; rewrite lockfile hosts → npmjs.com
# when the runner flakes on .org / leftover npmmirror URLs (see backend/Dockerfile).
ENV NODE_OPTIONS=--max-old-space-size=3072
RUN --mount=type=cache,target=/root/.npm \
npm config set registry https://registry.npmjs.com \
&& npm config set fetch-retries 5 \
&& npm config set fetch-retry-maxtimeout 120000 \
&& npm config set maxsockets 5 \
&& sed -i \
-e 's|https://registry.npmmirror.com/|https://registry.npmjs.com/|g' \
-e 's|https://registry.npmjs.org/|https://registry.npmjs.com/|g' \
package-lock.json \
&& npm ci --no-audit --no-fund \
&& test -e node_modules/.bin/next
COPY . .
@@ -37,12 +43,14 @@ RUN npm run build
# Production — minimal runtime using Next.js standalone bundle
FROM ${NODE_IMAGE} AS runner
RUN apk add --no-cache dumb-init
RUN apt-get update \
&& apt-get install -y --no-install-recommends dumb-init \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN addgroup -g 1001 -S nodejs && \
adduser -S dyolink -u 1001
RUN groupadd --system --gid 1001 nodejs \
&& useradd --system --uid 1001 --gid nodejs --home-dir /app --shell /usr/sbin/nologin dyolink
ENV NODE_ENV=production
ENV PORT=3000

File diff suppressed because it is too large Load Diff

View File

@@ -77,6 +77,7 @@ Workflow file: [`.gitea/workflows/registry-build-deploy.yml`](../.gitea/workflow
### 1. Docker Desktop
- Install and keep **Docker Desktop running** during builds/deploys.
- **WSL2 memory** (Docker Desktop no longer shows a RAM slider): optional `C:\Users\<user>\.wslconfig` with `[wsl2] memory=8GB` if builds feel tight. The usual CI `npm ci` failure on this host is **blocked `registry.npmjs.org`**, not RAM — Dockerfiles use **npmmirror** for installs.
- **Settings → Docker Engine** — allow HTTP registry:
```json
@@ -300,7 +301,8 @@ On the Windows host, from repo `infrastructure/`:
| Runner can't register on public IP | Use `http://127.0.0.1:3000` for `--instance` |
| Variable name rejected in Gitea | No `GITEA_*` / `GITHUB_*` prefixes; use `CLONE_HOST` |
| `413 Request Entity Too Large` on `docker push` to `https://gitea.wixur.ir/v2/…/blobs/uploads` | Nginx (or Cloudflare) in front of Gitea is rejecting the image layer. **Fix the proxy** (then `nginx -s reload`): in the `server { server_name gitea.wixur.ir; }` block set `client_max_body_size 0;` and `proxy_request_buffering off;` — snippet: [`nginx/windows-gitea.wixur.snippet.conf`](nginx/windows-gitea.wixur.snippet.conf). **Or skip the proxy:** set `REGISTRY_HOST=host.docker.internal:3000` (and Gitea `ROOT_URL`) so CI pushes to `:3000`. If the hostname is orange-clouded on Cloudflare, grey-cloud it (free plan caps uploads at 100MB). |
| `TLS handshake timeout` to `registry-1.docker.io` / `node:20-alpine` | Docker Hub is blocked or slow from the Windows runner. CI pulls `node:20-alpine` from **Arvan / ECR Public / GCR**, then pushes `<REGISTRY_PREFIX>/node:20-alpine` to Gitea (later builds skip Hub). Optional variable `NODE_IMAGE_SOURCE` (comma-separated image refs). One-time on the runner: `docker pull docker.arvancloud.ir/library/node:20-alpine` then tag/push to Gitea. |
| `TLS handshake timeout` to `registry-1.docker.io` / `node:20-bookworm-slim` | Docker Hub is blocked or slow from the Windows runner. CI pulls `node:20-bookworm-slim` from **Arvan / ECR Public / GCR**, then pushes `<REGISTRY_PREFIX>/node:20-bookworm-slim` to Gitea (later builds skip Hub). Optional variable `NODE_IMAGE_SOURCE` (comma-separated image refs). One-time on the runner: `docker pull docker.arvancloud.ir/library/node:20-bookworm-slim` then tag/push to Gitea. |
| `npm error Exit handler never called!` during backend/frontend image build | Almost always **network**: `registry.npmjs.org` unreachable (`ECONNRESET` / ~25 min hang). Confirm: `docker run --rm <REGISTRY_PREFIX>/node:20-bookworm-slim npm ping` fails, while `npm ping --registry https://registry.npmmirror.com` works. Dockerfiles already rewrite lockfile hosts to **npmmirror** for `npm ci` — ensure that commit is on the branch CI builds. Nested retries do not help. |
| `docker login` connection refused on `127.0.0.1:3000` | **Docker Desktop on Windows:** set `REGISTRY_HOST=host.docker.internal:3000`, add it to insecure-registries, set Gitea `ROOT_URL=http://host.docker.internal:3000/`. Keep `CLONE_HOST=127.0.0.1:3000` for git. |
| `docker login` / push denied, redirect to public IP | Set Gitea `ROOT_URL` to a host Docker can reach (`host.docker.internal:3000` on Windows Docker Desktop). |
| `server gave HTTP response to HTTPS client` | Add registry host to Docker **insecure-registries**, restart Docker |
@@ -331,7 +333,7 @@ docker logs dyolink_frontend_staging --tail 50
| Path | Role |
|------|------|
| `.gitea/workflows/registry-build-deploy.yml` | CI: build, push, deploy |
| `infrastructure/scripts/ci-resolve-node-image.ps1` | CI: cache `node:20-alpine` on Gitea so builds do not depend on Docker Hub |
| `infrastructure/scripts/ci-resolve-node-image.ps1` | CI: cache `node:20-bookworm-slim` on Gitea so builds do not depend on Docker Hub |
| `infrastructure/docker-compose.registry.yml` | Staging stack (pull-only images) |
| `infrastructure/deploy.registry.env.example` | Manual deploy env template |
| `infrastructure/database.staging.env.example` | Postgres secrets template |

View File

@@ -1,16 +1,16 @@
# Prefer a Gitea-hosted node:20-alpine so docker build does not HEAD registry-1.docker.io.
# Prefer a Gitea-hosted node:20-bookworm-slim so docker build does not HEAD registry-1.docker.io.
# Order: Gitea -> optional NODE_IMAGE_SOURCE -> regional/official mirrors -> Docker Hub last.
# ASCII only: Windows PowerShell 5.1 + act_runner mis-parses backtick escapes in this file.
param(
[Parameter(Mandatory = $true)][string]$RegistryPrefix,
[string]$OutFile = '.ci-node-image',
[string]$HubImage = 'node:20-alpine',
[string]$HubImage = 'node:20-bookworm-slim',
[AllowEmptyString()]
[string]$ExtraSources = ''
)
$ErrorActionPreference = 'Continue'
$mirror = "$RegistryPrefix/node:20-alpine"
$mirror = "$RegistryPrefix/node:20-bookworm-slim"
$nl = [char]10
function Test-Image([string]$Name) {
@@ -69,9 +69,9 @@ if (-not [string]::IsNullOrWhiteSpace($ExtraSources)) {
}
# Iran-reachable proxy of Docker Hub official images, then public official mirrors, Hub last.
foreach ($src in @(
'docker.arvancloud.ir/library/node:20-alpine',
'public.ecr.aws/docker/library/node:20-alpine',
'mirror.gcr.io/library/node:20-alpine',
'docker.arvancloud.ir/library/node:20-bookworm-slim',
'public.ecr.aws/docker/library/node:20-bookworm-slim',
'mirror.gcr.io/library/node:20-bookworm-slim',
$HubImage
)) {
if (-not $sources.Contains($src)) { [void]$sources.Add($src) }
@@ -90,11 +90,11 @@ foreach ($src in $sources) {
}
}
Write-Host "Could not pull node:20-alpine from Gitea, mirrors, or Docker Hub."
Write-Host "Could not pull node:20-bookworm-slim from Gitea, mirrors, or Docker Hub."
Write-Host "Set repository variable NODE_IMAGE_SOURCE to a reachable image, for example:"
Write-Host " docker.arvancloud.ir/library/node:20-alpine"
Write-Host " docker.arvancloud.ir/library/node:20-bookworm-slim"
Write-Host "Or on the Windows runner:"
Write-Host " docker pull docker.arvancloud.ir/library/node:20-alpine"
Write-Host " docker tag docker.arvancloud.ir/library/node:20-alpine $mirror"
Write-Host " docker pull docker.arvancloud.ir/library/node:20-bookworm-slim"
Write-Host " docker tag docker.arvancloud.ir/library/node:20-bookworm-slim $mirror"
Write-Host " docker push $mirror"
exit 1