Files
psf-bch-api-base/dev-docs/update-logs/2026-04-02.md
T

1.4 KiB

2026-04-02 Update Log

Summary

Docker deployments now run npm run docs at container start via an entrypoint script, and optionally apply APIDOC_URL from the environment so apiDoc HTML matches each deployment subdomain or public URL.

Changes Made

  • Added scripts/patch-apidoc-from-env.js to set apidoc.json and package.json apidoc.url from APIDOC_URL (dotenv loads the project .env, same path as bin/server.js).
  • Added production/docker/entrypoint.sh to run the patch script, npm run docs, then exec npm start.
  • Updated production/docker/Dockerfile to remove build-time npm run docs, copy the entrypoint and patch script from the build context, and use ENTRYPOINT for the shell script.
  • Updated production/docker/docker-compose.yml to use build context: ../.. and dockerfile: production/docker/Dockerfile so COPY paths resolve from the repository root.
  • Compose mounts ./.env at /home/safeuser/psf-bch-api/.env so the app and entrypoint share one file (not /home/safeuser/.env).
  • Documented APIDOC_URL in .env-example, production/docker/.env-example, and README.md (Production Docker section).

Outcome

  • Operators can set APIDOC_URL in the mounted .env (for example https://api.example.com) per instance without rebuilding the image for each subdomain.
  • The HTML apiDoc bundle is regenerated on every container start so it stays aligned with the configured URL.