Companion to ff92706 (drift test fix). The inline handler moves to a
module exporting { buildRouter, getVersion, getName }, pre-built once
at startup and mounted bare on apiRouter — the exact shape the drift
test walker now recognizes. Dockerfile builder stage switches to
npm ci --omit=dev for deterministic builds. Tests: 12/12 across the
three new/updated suites; full suite 1837/1837.
41 lines
1.2 KiB
Docker
41 lines
1.2 KiB
Docker
# ── Dependency stage: deterministic production-only install ────────────────
|
|
FROM node:20.11.1-alpine3.19 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
# ── Production stage: only production deps + source ──────────────────────────
|
|
FROM node:20.11.1-alpine3.19
|
|
|
|
WORKDIR /app
|
|
|
|
# Install OpenSSL for certificate generation
|
|
RUN apk add --no-cache openssl
|
|
|
|
# Copy production dependencies from builder
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
# Copy application source
|
|
COPY *.js ./
|
|
COPY src/ ./src/
|
|
COPY routes/ ./routes/
|
|
COPY openapi.yaml ./
|
|
COPY package.json ./
|
|
|
|
# VERSION file holds the short git SHA the image was built from.
|
|
COPY VERSION ./
|
|
|
|
# Note: Running as root because container needs Docker socket access
|
|
# (which is root-equivalent anyway). Socket access required for container management.
|
|
|
|
EXPOSE 3001
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD node -e "require('http').get('http://localhost:3001/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1))"
|
|
|
|
CMD ["node", "server.js"]
|