Modelled on dynamic-qr: Traefik Gateway with Let's Encrypt, Longhorn PVC, 1 replica with Recreate, Calico network policies, and a rate limit on POST /api/leads. CI runs the tests in a Dockerfile stage before pushing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
18 lines
501 B
Docker
18 lines
501 B
Docker
FROM node:22-alpine AS base
|
|
WORKDIR /app
|
|
COPY package.json server.js ./
|
|
COPY public ./public
|
|
|
|
# CI builds this stage first (`--target test`); a failing test stops the image from being pushed.
|
|
FROM base AS test
|
|
COPY server.test.js ./
|
|
RUN node --disable-warning=ExperimentalWarning --test
|
|
|
|
FROM base
|
|
ENV NODE_ENV=production PORT=3000 DB_PATH=/data/leads.db
|
|
RUN mkdir -p /data && chown node:node /data
|
|
USER node
|
|
VOLUME /data
|
|
EXPOSE 3000
|
|
CMD ["node", "--disable-warning=ExperimentalWarning", "server.js"]
|