feat(docker): migrate NoteLett to Gitea registry-backed Docker pattern

- Convert all @bytelyst/* file: refs to semver ^0.1.0 (backend, web, mobile)
- Remove sibling common-plat workspace references from pnpm-workspace.yaml
- Add .npmrc and .npmrc.docker for local Gitea registry
- Rewrite backend/web Dockerfiles: pnpm + BuildKit secret mount + corp proxy
- Fix backend tsconfig.json: remove explicit lib to resolve fetch Response types
- Verified: host-side pnpm install, backend tests (86 pass), backend+web Docker builds
This commit is contained in:
saravanakumardb1 2026-03-23 20:11:12 -07:00
parent 1da2dcc7d9
commit 33f9379f4a
10 changed files with 481 additions and 2118 deletions

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
@bytelyst:registry=http://localhost:3300/api/packages/bytelyst/npm/
//localhost:3300/api/packages/bytelyst/npm/:_authToken=${GITEA_NPM_TOKEN}
strict-ssl=false

3
.npmrc.docker Normal file
View File

@ -0,0 +1,3 @@
@bytelyst:registry=http://${GITEA_NPM_HOST}:3300/api/packages/bytelyst/npm/
//${GITEA_NPM_HOST}:3300/api/packages/bytelyst/npm/:_authToken=${GITEA_NPM_TOKEN}
strict-ssl=false

View File

@ -1,39 +1,43 @@
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs FROM node:22-alpine AS builder
# ── Stage 1: Build ────────────────────────────────────
FROM node:22-slim AS builder
WORKDIR /app/backend WORKDIR /app/backend
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm config set strict-ssl false ARG GITEA_NPM_HOST
ENV HTTP_PROXY=http://cso.proxy.att.com:8080/
ENV HTTPS_PROXY=http://cso.proxy.att.com:8080/
ENV NO_PROXY=localhost,127.0.0.1,host.docker.internal,gateway.docker.internal,192.168.65.254,192.168.86.40
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
ENV NPM_CONFIG_STRICT_SSL=false
ENV GITEA_NPM_HOST=$GITEA_NPM_HOST
RUN npm config set strict-ssl false \
&& npm config set registry https://jfrog-pkg-proxy.it.att.com/artifactory/api/npm/att-npm-proxy-group/ \
&& npm install -g pnpm@10.6.5
COPY .npmrc.docker ./.npmrc
COPY backend/package.json ./package.json COPY backend/package.json ./package.json
COPY backend/.docker-deps/ ./.docker-deps/ RUN --mount=type=secret,id=gitea_npm_token \
RUN npm install export GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm_token)" && \
pnpm install --ignore-scripts --lockfile=false
COPY backend/tsconfig.json ./tsconfig.json COPY backend/tsconfig.json ./tsconfig.json
COPY backend/src/ ./src/ COPY backend/src/ ./src/
COPY shared/ ./shared/ COPY shared/ ../shared/
RUN npm run build RUN pnpm run build
# ── Stage 2: Runtime ────────────────────────────────── # Production stage
FROM node:22-slim AS deps FROM node:22-alpine
WORKDIR /app/backend WORKDIR /app/backend
ENV NODE_ENV=production ENV NODE_ENV=production
ENV HTTP_PROXY=http://cso.proxy.att.com:8080/
ENV HTTPS_PROXY=http://cso.proxy.att.com:8080/
ENV NO_PROXY=localhost,127.0.0.1,host.docker.internal,gateway.docker.internal,192.168.65.254,192.168.86.40
ENV NODE_TLS_REJECT_UNAUTHORIZED=0 ENV NODE_TLS_REJECT_UNAUTHORIZED=0
ENV NPM_CONFIG_STRICT_SSL=false
RUN npm config set strict-ssl false COPY --from=builder /app/backend/node_modules ./node_modules
COPY backend/package.json ./package.json COPY --from=builder /app/backend/package.json ./package.json
COPY backend/.docker-deps/ ./.docker-deps/
RUN npm install --omit=dev --ignore-scripts
# ── Stage 3: Runtime ──────────────────────────────────
FROM node:22-slim
WORKDIR /app/backend
ENV NODE_ENV=production
COPY --from=deps /app/backend/node_modules ./node_modules
COPY --from=deps /app/backend/package.json ./package.json
COPY --from=builder /app/backend/dist ./dist COPY --from=builder /app/backend/dist ./dist
COPY shared/product.json ../shared/product.json COPY shared/ ../shared/
EXPOSE 4016 EXPOSE 4016
CMD ["node", "dist/server.js"] CMD ["node", "dist/server.js"]

View File

@ -15,24 +15,24 @@
}, },
"dependencies": { "dependencies": {
"@azure/cosmos": "^4.2.0", "@azure/cosmos": "^4.2.0",
"@bytelyst/auth": "file:../../learning_ai_common_plat/packages/auth", "@bytelyst/auth": "^0.1.0",
"@bytelyst/config": "file:../../learning_ai_common_plat/packages/config", "@bytelyst/config": "^0.1.0",
"@bytelyst/cosmos": "file:../../learning_ai_common_plat/packages/cosmos", "@bytelyst/cosmos": "^0.1.0",
"@bytelyst/datastore": "file:../../learning_ai_common_plat/packages/datastore", "@bytelyst/datastore": "^0.1.0",
"@bytelyst/backend-config": "file:../../learning_ai_common_plat/packages/backend-config", "@bytelyst/backend-config": "^0.1.0",
"@bytelyst/backend-flags": "file:../../learning_ai_common_plat/packages/backend-flags", "@bytelyst/backend-flags": "^0.1.0",
"@bytelyst/backend-telemetry": "file:../../learning_ai_common_plat/packages/backend-telemetry", "@bytelyst/backend-telemetry": "^0.1.0",
"@bytelyst/errors": "file:../../learning_ai_common_plat/packages/errors", "@bytelyst/errors": "^0.1.0",
"@bytelyst/field-encrypt": "file:../../learning_ai_common_plat/packages/field-encrypt", "@bytelyst/field-encrypt": "^0.1.0",
"@bytelyst/fastify-auth": "file:../../learning_ai_common_plat/packages/fastify-auth", "@bytelyst/fastify-auth": "^0.1.0",
"@bytelyst/fastify-core": "file:../../learning_ai_common_plat/packages/fastify-core", "@bytelyst/fastify-core": "^0.1.0",
"@bytelyst/logger": "file:../../learning_ai_common_plat/packages/logger", "@bytelyst/logger": "^0.1.0",
"fastify": "5.7.4", "fastify": "5.7.4",
"jose": "^6.0.8", "jose": "^6.0.8",
"zod": "^3.24.2" "zod": "^3.24.2"
}, },
"devDependencies": { "devDependencies": {
"@bytelyst/testing": "file:../../learning_ai_common_plat/packages/testing", "@bytelyst/testing": "^0.1.0",
"@types/node": "^22.12.0", "@types/node": "^22.12.0",
"tsx": "^4.19.2", "tsx": "^4.19.2",
"typescript": "^5.7.3", "typescript": "^5.7.3",

View File

@ -3,7 +3,7 @@
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"lib": ["ES2022"],
"outDir": "dist", "outDir": "dist",
"rootDir": "src", "rootDir": "src",
"strict": true, "strict": true,

View File

@ -15,15 +15,15 @@
"lint": "eslint . --ext .ts,.tsx" "lint": "eslint . --ext .ts,.tsx"
}, },
"dependencies": { "dependencies": {
"@bytelyst/api-client": "file:../../learning_ai_common_plat/packages/api-client", "@bytelyst/api-client": "^0.1.0",
"@bytelyst/auth-client": "file:../../learning_ai_common_plat/packages/auth-client", "@bytelyst/auth-client": "^0.1.0",
"@bytelyst/blob-client": "file:../../learning_ai_common_plat/packages/blob-client", "@bytelyst/blob-client": "^0.1.0",
"@bytelyst/design-tokens": "file:../../learning_ai_common_plat/packages/design-tokens", "@bytelyst/design-tokens": "^0.1.0",
"@bytelyst/diagnostics-client": "file:../../learning_ai_common_plat/packages/diagnostics-client", "@bytelyst/diagnostics-client": "^0.1.0",
"@bytelyst/feature-flag-client": "file:../../learning_ai_common_plat/packages/feature-flag-client", "@bytelyst/feature-flag-client": "^0.1.0",
"@bytelyst/kill-switch-client": "file:../../learning_ai_common_plat/packages/kill-switch-client", "@bytelyst/kill-switch-client": "^0.1.0",
"@bytelyst/offline-queue": "file:../../learning_ai_common_plat/packages/offline-queue", "@bytelyst/offline-queue": "^0.1.0",
"@bytelyst/telemetry-client": "file:../../learning_ai_common_plat/packages/telemetry-client", "@bytelyst/telemetry-client": "^0.1.0",
"expo": "~55.0.4", "expo": "~55.0.4",
"expo-router": "~6.0.4", "expo-router": "~6.0.4",
"expo-status-bar": "~3.0.9", "expo-status-bar": "~3.0.9",

2426
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,3 @@ packages:
- backend - backend
- web - web
- mobile - mobile
- ../learning_ai_common_plat/packages/*
- learning_ai_common_plat/packages/*

View File

@ -1,29 +1,42 @@
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs FROM node:22-alpine AS builder
# ── Stage 1: Install ──────────────────────────────────
FROM node:22-slim AS builder
WORKDIR /app/web WORKDIR /app/web
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm config set strict-ssl false
COPY web/package.json ./package.json
COPY web/.docker-deps/ ./.docker-deps/
RUN npm install --legacy-peer-deps
COPY web/ ./ ARG GITEA_NPM_HOST
ENV HTTP_PROXY=http://cso.proxy.att.com:8080/
ENV HTTPS_PROXY=http://cso.proxy.att.com:8080/
ENV NO_PROXY=localhost,127.0.0.1,host.docker.internal,gateway.docker.internal,192.168.65.254,192.168.86.40
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
ENV NPM_CONFIG_STRICT_SSL=false
ENV GITEA_NPM_HOST=$GITEA_NPM_HOST
RUN npm config set strict-ssl false \
&& npm config set registry https://jfrog-pkg-proxy.it.att.com/artifactory/api/npm/att-npm-proxy-group/ \
&& npm install -g pnpm@10.6.5
COPY .npmrc.docker ./.npmrc
COPY web/package.json ./package.json
RUN --mount=type=secret,id=gitea_npm_token \
export GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm_token)" && \
pnpm install --ignore-scripts --lockfile=false
COPY web/next.config.ts ./next.config.ts
COPY web/tsconfig.json ./tsconfig.json
COPY web/next-env.d.ts ./next-env.d.ts
COPY web/src/ ./src/
COPY shared/ ../shared/ COPY shared/ ../shared/
# Dummy env vars for Next.js build-time page data collection
ENV NEXT_PUBLIC_BACKEND_URL=http://localhost:4016
ENV NEXT_PUBLIC_PLATFORM_URL=http://localhost:4003
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_TLS_REJECT_UNAUTHORIZED=0 RUN pnpm run build
RUN npm run build FROM node:22-alpine
WORKDIR /app/web
# ── Stage 2: Runtime ──────────────────────────────────
FROM node:22-slim
WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV HTTP_PROXY=http://cso.proxy.att.com:8080/
ENV HTTPS_PROXY=http://cso.proxy.att.com:8080/
ENV NO_PROXY=localhost,127.0.0.1,host.docker.internal,gateway.docker.internal,192.168.65.254,192.168.86.40
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
ENV NPM_CONFIG_STRICT_SSL=false
COPY --from=builder /app/web/.next/standalone ./ COPY --from=builder /app/web/.next/standalone ./
COPY --from=builder /app/web/.next/static ./.next/static COPY --from=builder /app/web/.next/static ./.next/static

View File

@ -13,15 +13,15 @@
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@bytelyst/api-client": "file:../../learning_ai_common_plat/packages/api-client", "@bytelyst/api-client": "^0.1.0",
"@bytelyst/design-tokens": "file:../../learning_ai_common_plat/packages/design-tokens", "@bytelyst/design-tokens": "^0.1.0",
"@bytelyst/blob-client": "file:../../learning_ai_common_plat/packages/blob-client", "@bytelyst/blob-client": "^0.1.0",
"@bytelyst/diagnostics-client": "file:../../learning_ai_common_plat/packages/diagnostics-client", "@bytelyst/diagnostics-client": "^0.1.0",
"@bytelyst/feature-flag-client": "file:../../learning_ai_common_plat/packages/feature-flag-client", "@bytelyst/feature-flag-client": "^0.1.0",
"@bytelyst/kill-switch-client": "file:../../learning_ai_common_plat/packages/kill-switch-client", "@bytelyst/kill-switch-client": "^0.1.0",
"@bytelyst/platform-client": "file:../../learning_ai_common_plat/packages/platform-client", "@bytelyst/platform-client": "^0.1.0",
"@bytelyst/react-auth": "file:../../learning_ai_common_plat/packages/react-auth", "@bytelyst/react-auth": "^0.1.0",
"@bytelyst/telemetry-client": "file:../../learning_ai_common_plat/packages/telemetry-client", "@bytelyst/telemetry-client": "^0.1.0",
"lucide-react": "^0.575.0", "lucide-react": "^0.575.0",
"next": "16.1.6", "next": "16.1.6",
"react": "19.2.0", "react": "19.2.0",