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
# ── Stage 1: Build ────────────────────────────────────
FROM node:22-slim AS builder
FROM node:22-alpine AS builder
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/.docker-deps/ ./.docker-deps/
RUN npm install
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 backend/tsconfig.json ./tsconfig.json
COPY backend/src/ ./src/
COPY shared/ ./shared/
RUN npm run build
COPY shared/ ../shared/
RUN pnpm run build
# ── Stage 2: Runtime ──────────────────────────────────
FROM node:22-slim AS deps
# Production stage
FROM node:22-alpine
WORKDIR /app/backend
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 NPM_CONFIG_STRICT_SSL=false
RUN npm config set strict-ssl false
COPY 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/node_modules ./node_modules
COPY --from=builder /app/backend/package.json ./package.json
COPY --from=builder /app/backend/dist ./dist
COPY shared/product.json ../shared/product.json
COPY shared/ ../shared/
EXPOSE 4016
CMD ["node", "dist/server.js"]

View File

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

View File

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

View File

@ -15,15 +15,15 @@
"lint": "eslint . --ext .ts,.tsx"
},
"dependencies": {
"@bytelyst/api-client": "file:../../learning_ai_common_plat/packages/api-client",
"@bytelyst/auth-client": "file:../../learning_ai_common_plat/packages/auth-client",
"@bytelyst/blob-client": "file:../../learning_ai_common_plat/packages/blob-client",
"@bytelyst/design-tokens": "file:../../learning_ai_common_plat/packages/design-tokens",
"@bytelyst/diagnostics-client": "file:../../learning_ai_common_plat/packages/diagnostics-client",
"@bytelyst/feature-flag-client": "file:../../learning_ai_common_plat/packages/feature-flag-client",
"@bytelyst/kill-switch-client": "file:../../learning_ai_common_plat/packages/kill-switch-client",
"@bytelyst/offline-queue": "file:../../learning_ai_common_plat/packages/offline-queue",
"@bytelyst/telemetry-client": "file:../../learning_ai_common_plat/packages/telemetry-client",
"@bytelyst/api-client": "^0.1.0",
"@bytelyst/auth-client": "^0.1.0",
"@bytelyst/blob-client": "^0.1.0",
"@bytelyst/design-tokens": "^0.1.0",
"@bytelyst/diagnostics-client": "^0.1.0",
"@bytelyst/feature-flag-client": "^0.1.0",
"@bytelyst/kill-switch-client": "^0.1.0",
"@bytelyst/offline-queue": "^0.1.0",
"@bytelyst/telemetry-client": "^0.1.0",
"expo": "~55.0.4",
"expo-router": "~6.0.4",
"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
- web
- 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
# ── Stage 1: Install ──────────────────────────────────
FROM node:22-slim AS builder
FROM node:22-alpine AS builder
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/
# 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 NODE_TLS_REJECT_UNAUTHORIZED=0
RUN pnpm run build
RUN npm run build
# ── Stage 2: Runtime ──────────────────────────────────
FROM node:22-slim
WORKDIR /app
FROM node:22-alpine
WORKDIR /app/web
ENV NODE_ENV=production
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/static ./.next/static

View File

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