feat: squelette orchestrateur TS fail-closed (v0.5.0)

Bootstrap backend Phase 1 : config zod fail-closed (refuse de démarrer
sans secret ; verrou lecture seule Portainer ; secrets masqués), logger
pino + journal d'audit, Dockerfile multi-stage non-root base épinglée,
vitest. Deps épinglées, npm audit 0 vuln, typecheck vert.

Palier de risque : reversible (aucune écriture branchée).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Kantin-Petit
2026-06-23 01:09:02 +02:00
parent 6eda8312a6
commit 5fcb3ef18d
11 changed files with 3899 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# CHLOVA backend — image multi-stage, base épinglée (jamais :latest).
# TODO épingler le digest (node:22.14-bookworm-slim@sha256:...) avant déploiement réel.
FROM node:22.14-bookworm-slim AS build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY tsconfig.json ./
COPY src ./src
RUN npm run build
FROM node:22.14-bookworm-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev && npm cache clean --force
COPY --from=build /app/dist ./dist
# Données runtime (SQLite, P2+). L'utilisateur node ne tourne pas en root.
RUN mkdir -p /app/data && chown -R node:node /app
USER node
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:8080/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "dist/index.js"]