All checks were successful
CI / Lint, typecheck, test (push) Successful in 3m11s
CI / Build container images (push) Has been skipped
CD / Build and push images (push) Successful in 3m44s
CD / Deploy to Test (push) Successful in 9s
CD / Smoke tests against Test (push) Successful in 1m10s
CD / Promote to Int (push) Successful in 10s
CI / Auth e2e pack (push) Successful in 5m13s
CI / Import/export fidelity gate (push) Successful in 46s
readyz now enumerates database/migrations (hard failures, HTTP 503), converter/renderer, and a new backup check that reads the sidecar's status.json from the read-only backups mount and warns when the last successful backup is older than 26 h. Warning-level checks surface as overall status "degraded" while staying HTTP 200 — monitors alert on the body keyword, Docker healthchecks keep using the liveness endpoints so a degraded instance is never restart-looped. The status.json shape moved to @dorfteich/shared as the contract between the sidecar and its readers (#85/#86); deploy/monitoring.md defines the Uptime-Kuma monitor set per stage. The api image also pre-creates /data/backups node-owned so the shared backups volume stays writable for the sidecar regardless of which container initializes it, and the sidecar's scheduler survives runs that cannot even record their status. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EwZ4jR4KFAPvpjWevfUGX1
48 lines
2.5 KiB
Docker
48 lines
2.5 KiB
Docker
# Build context is the repository root (workspace build):
|
|
# docker build -f apps/api/Dockerfile .
|
|
|
|
FROM node:22.15-alpine AS build
|
|
WORKDIR /repo
|
|
RUN npm install -g pnpm@11
|
|
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json tsconfig.base.json ./
|
|
COPY packages/shared ./packages/shared
|
|
COPY packages/plugin-sdk ./packages/plugin-sdk
|
|
COPY apps/api ./apps/api
|
|
COPY deploy/fonts ./deploy/fonts
|
|
RUN pnpm install --frozen-lockfile --filter @dorfteich/api... \
|
|
&& pnpm --filter @dorfteich/shared build \
|
|
&& pnpm --filter @dorfteich/plugin-sdk build \
|
|
&& pnpm --filter @dorfteich/api build \
|
|
# Bake the self-hosted font catalog in so the PDF exporter can inline a
|
|
# pond's fonts as base64 (ADR 0016). Same download as the web image; fails
|
|
# the build if a family lacks license info.
|
|
&& FONTS_OUT=/repo/fonts node deploy/fonts/build-fonts.mjs \
|
|
# Self-contained production bundle (prod deps only, incl. the prisma CLI
|
|
# needed for migrate-on-start) at /out.
|
|
&& pnpm --filter @dorfteich/api deploy --prod --legacy /out \
|
|
&& cp -r apps/api/dist /out/dist \
|
|
&& cp -r /repo/fonts /out/fonts
|
|
|
|
FROM node:22.15-alpine
|
|
ARG APP_VERSION=0.0.0-dev
|
|
# Default the data dirs to the writable, node-owned locations created below, so
|
|
# the image works out of the box even where compose does not set them; compose
|
|
# still mounts named volumes here for persistence (UPLOADS_DIR/PLUGINS_DIR).
|
|
ENV NODE_ENV=production APP_VERSION=${APP_VERSION} UPLOADS_DIR=/data/uploads PLUGINS_DIR=/data/plugins SECRETS_FILE=/data/secrets/secrets.env BACKUPS_DIR=/data/backups
|
|
WORKDIR /app
|
|
COPY --from=build --chown=node:node /out /app
|
|
# Generate the Prisma client for this image's platform.
|
|
RUN node node_modules/prisma/build/index.js generate
|
|
# A fresh named volume mounted at /data/uploads or /data/plugins is created
|
|
# root-owned; pre-creating them here (Docker copies an image directory's
|
|
# ownership into a new volume on first mount) lets the non-root `node` user
|
|
# write to them. /data/backups is mounted read-only here, but pre-creating it
|
|
# node-owned keeps the shared `backups` volume writable for the backup
|
|
# sidecar even when the api container is the one that initializes it.
|
|
RUN mkdir -p /data/uploads /data/plugins /data/secrets /data/backups && chown -R node:node /data/uploads /data/plugins /data/secrets /data/backups
|
|
USER node
|
|
EXPOSE 3000
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
|
|
CMD node -e "fetch('http://127.0.0.1:'+(process.env.PORT||3000)+'/api/v1/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
CMD ["node", "dist/main.js"]
|