- server.js uses pg (pinned 8.23.1), reads DATABASE_URL, creates the leads table on start, fails fast if Postgres is unreachable - tests run against a real Postgres in a throwaway schema - CI runs the test image against a throwaway Postgres on DinD - k8s: Postgres 18 StatefulSet (Longhorn, 2Gi), init container wait, password secret, network policy app-to-postgres; app no longer needs a volume or Recreate - README: DBeaver via port-forward, CSV export via docs/export-leads.sql Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
19 lines
440 B
Docker
19 lines
440 B
Docker
FROM node:22-alpine AS base
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev
|
|
COPY server.js ./
|
|
COPY public ./public
|
|
|
|
# CI runs this stage against a throwaway Postgres (TEST_DATABASE_URL); a failing test stops the push.
|
|
FROM base AS test
|
|
COPY server.test.js ./
|
|
COPY docs/schema.sql ./docs/schema.sql
|
|
CMD ["node", "--test"]
|
|
|
|
FROM base
|
|
ENV NODE_ENV=production PORT=3000
|
|
USER node
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|