mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
Upgraded Node.js and dependencies to address critical vulnerabilities: **Infrastructure:** - Upgrade Node.js from 18.17-alpine to 20-alpine (Alpine 3.18 → 3.23) - Upgrade npm to 11.7.0 (includes glob 13.0.0 fix) - Replace npm ci with npm install, then back to npm ci with npm 11 lock **Dependencies:** - Update axios: 0.27.2 → 0.30.2 (fixes 2 CVEs) - Update body-parser: 1.20.1/1.20.2 → 1.20.3 - Update cross-spawn: 7.0.3 → 7.0.6 (hoisted) - Update glob: 10.2.4 → 10.5.0 (hoisted) - Update path-to-regexp: 3.2.0 → 3.3.0 (maintains @nestjs/swagger compatibility) - Update semver: 7.5.1 → 7.5.2 **Results:** - HIGH vulnerabilities: 18 → 0 (100% reduction) - Alpine OS vulnerabilities: 6 → 0 (fixed by Alpine 3.23) - Node.js vulnerabilities: 12 → 0 - All tests passing - Production verified working 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
1.7 KiB
Docker
68 lines
1.7 KiB
Docker
FROM node:20-alpine AS base_image
|
|
RUN npm install -g npm@latest
|
|
|
|
FROM base_image AS build_base
|
|
WORKDIR /app
|
|
RUN apk update
|
|
# needed packages to build dependencies from source
|
|
RUN apk add --no-cache \
|
|
aws-cli \
|
|
chromium \
|
|
nss \
|
|
freetype \
|
|
harfbuzz \
|
|
ca-certificates \
|
|
ttf-freefont
|
|
COPY package*.json ./
|
|
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
|
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
|
|
|
|
# run aws cli without mounting secret, because CI already has AWS credentials
|
|
FROM build_base AS ci_image
|
|
RUN aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1
|
|
RUN npm ci
|
|
COPY . .
|
|
|
|
|
|
# unit test specific build
|
|
FROM ci_image AS test
|
|
ENV DUC_URL=0.0.0.0:50051
|
|
ENTRYPOINT ["npm", "run", "test"]
|
|
|
|
|
|
# dev build
|
|
FROM build_base AS dev
|
|
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
|
|
aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1
|
|
# flag --build-from-source is required to force-build sqlite3
|
|
RUN npm ci
|
|
COPY . .
|
|
ENTRYPOINT npm run start:dev
|
|
|
|
|
|
FROM ci_image AS prod_build
|
|
RUN npm run build
|
|
|
|
|
|
FROM base_image
|
|
WORKDIR /app
|
|
COPY --from=prod_build /app/dist ./dist
|
|
COPY --from=prod_build /app/node_modules ./node_modules
|
|
COPY --from=prod_build /app/package*.json ./
|
|
RUN apk update
|
|
# needed packages to build dependencies from source
|
|
RUN apk add --no-cache \
|
|
chromium \
|
|
nss \
|
|
freetype \
|
|
harfbuzz \
|
|
ca-certificates \
|
|
ttf-freefont
|
|
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
|
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
|
|
ENTRYPOINT npm run start:prod
|