{"_id":"@barissozudogru/healthcheck-gen","_rev":"3-35791bc8e3190d98860265f87477c320","name":"@barissozudogru/healthcheck-gen","dist-tags":{"latest":"0.5.1"},"versions":{"0.4.0":{"name":"@barissozudogru/healthcheck-gen","version":"0.4.0","keywords":["docker","healthcheck","dockerfile","generator","cli"],"author":{"name":"Baris Sozudogru"},"license":"MIT","_id":"@barissozudogru/healthcheck-gen@0.4.0","maintainers":[{"name":"barissozudogru","email":"barissozudogru@gmail.com"}],"homepage":"https://github.com/barissozudogru/healthcheck-gen#readme","bugs":{"url":"https://github.com/barissozudogru/healthcheck-gen/issues"},"bin":{"healthcheck-gen":"dist/cli.js"},"dist":{"shasum":"5cad3334a87e7c9d4bbbfe6fb6bf8a9949db92a0","tarball":"https://registry.npmjs.org/@barissozudogru/healthcheck-gen/-/healthcheck-gen-0.4.0.tgz","fileCount":9,"integrity":"sha512-5375PWEzZuGtlqCX75Go6si5oLdY6zB8xOqHgz4FgnxMsywLpvDHrLsR2J65HIC5wWpTJraRkK8CLLgR88yxzQ==","signatures":[{"sig":"MEUCIHEEd6EospJVvXGCNAdnS6wjhvYQBUt6J5W2QlmXfagsAiEAlFZau9X/u3B2GWpCYC8EldnqVjCRYdGlXRvv9vIckbs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32954},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"b6c11a79625665d67da144c052c65fc05552da24","scripts":{"test":"npm run build && node --test test/*.test.js","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"barissozudogru","email":"barissozudogru@gmail.com"},"repository":{"url":"git+https://github.com/barissozudogru/healthcheck-gen.git","type":"git"},"_npmVersion":"11.6.2","description":"Generate Docker HEALTHCHECK instructions from Dockerfile analysis","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^22.19.15"},"_npmOperationalInternal":{"tmp":"tmp/healthcheck-gen_0.4.0_1787176154738_0.20023750918187821","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@barissozudogru/healthcheck-gen","version":"0.5.0","keywords":["docker","healthcheck","dockerfile","container-health","devops","generator","ci","cli"],"author":{"name":"Baris Sozudogru"},"license":"MIT","_id":"@barissozudogru/healthcheck-gen@0.5.0","maintainers":[{"name":"barissozudogru","email":"barissozudogru@gmail.com"}],"homepage":"https://petri-labs.org/tools/healthcheck-gen/","bugs":{"url":"https://github.com/barissozudogru/healthcheck-gen/issues"},"bin":{"healthcheck-gen":"dist/cli.js"},"dist":{"shasum":"0ec04c3f165377aa49421d0b393f5940a7e6d3d6","tarball":"https://registry.npmjs.org/@barissozudogru/healthcheck-gen/-/healthcheck-gen-0.5.0.tgz","fileCount":9,"integrity":"sha512-OAx5CgLvS5BfftlcRBlMNP0daiEKtFVGa9c4/iKBm198p0zkWid5NPnQHMH5haos+wxiLV03PxUQ0k+5n2seVg==","signatures":[{"sig":"MEUCIQCfROUWLIZIixjBnBhL7FRy0ONgRXH+ETSijlFR7j4K4gIgFk1PqLEJoOFfbTCc8W50P7rJyOI3+uaFE2tcuNPDO8w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35447},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"fd199889e55088736b5a8c9cbd627188912a7648","scripts":{"test":"npm run build && node --test test/*.test.js","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"barissozudogru","email":"barissozudogru@gmail.com"},"repository":{"url":"git+https://github.com/barissozudogru/healthcheck-gen.git","type":"git"},"_npmVersion":"11.6.2","description":"Generate Docker HEALTHCHECK instructions from Dockerfile analysis","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^22.19.15"},"_npmOperationalInternal":{"tmp":"tmp/healthcheck-gen_0.5.0_1787699104673_0.038135783644344556","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@barissozudogru/healthcheck-gen","version":"0.5.1","description":"Generate Docker HEALTHCHECK instructions from Dockerfile analysis","type":"module","bin":{"healthcheck-gen":"dist/cli.js"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"build":"tsc","test":"npm run build && node --test test/*.test.js","prepublishOnly":"npm run build"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"repository":{"type":"git","url":"git+https://github.com/barissozudogru/healthcheck-gen.git"},"homepage":"https://petri-labs.org/tools/healthcheck-gen/","bugs":{"url":"https://github.com/barissozudogru/healthcheck-gen/issues"},"keywords":["docker","healthcheck","dockerfile","container-health","devops","generator","ci","cli"],"author":{"name":"Baris Sozudogru"},"license":"MIT","devDependencies":{"@types/node":"^22.19.15","typescript":"^5.9.3"},"gitHead":"3b323729ba94fcf7549176f31b9a839fb449624a","_id":"@barissozudogru/healthcheck-gen@0.5.1","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-y6QXehGHNyk5ph1l/yaO9jOCVQbWziFTimQg6ePptOV0fxVeMh5AhoJjLREIYLaUl4PasgMn5lkO0JVWR6+rMQ==","shasum":"e24b364af0ea990ffc79f84e5a132fbda858d467","tarball":"https://registry.npmjs.org/@barissozudogru/healthcheck-gen/-/healthcheck-gen-0.5.1.tgz","fileCount":9,"unpackedSize":35543,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDkqmnN61J0q9k+nljPsMjAoVtPuBlxRwtZmhYmrdfOGAiEAhc55U9GqLrZkQ3OjX+TnMZgVBwhY1FFn5S50mKTR9TQ="}]},"_npmUser":{"name":"barissozudogru","email":"barissozudogru@gmail.com"},"directories":{},"maintainers":[{"name":"barissozudogru","email":"barissozudogru@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/healthcheck-gen_0.5.1_1787745746154_0.4353867369536284"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-19T21:49:14.569Z","modified":"2026-08-26T12:02:26.527Z","0.4.0":"2026-08-19T21:49:14.870Z","0.5.0":"2026-08-25T23:05:04.812Z","0.5.1":"2026-08-26T12:02:26.302Z"},"bugs":{"url":"https://github.com/barissozudogru/healthcheck-gen/issues"},"author":{"name":"Baris Sozudogru"},"license":"MIT","homepage":"https://petri-labs.org/tools/healthcheck-gen/","keywords":["docker","healthcheck","dockerfile","container-health","devops","generator","ci","cli"],"repository":{"type":"git","url":"git+https://github.com/barissozudogru/healthcheck-gen.git"},"description":"Generate Docker HEALTHCHECK instructions from Dockerfile analysis","maintainers":[{"name":"barissozudogru","email":"barissozudogru@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"./assets/social-preview.svg\" alt=\"healthcheck-gen\" width=\"900\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@barissozudogru/healthcheck-gen\"><img alt=\"npm version\" src=\"https://img.shields.io/npm/v/@barissozudogru/healthcheck-gen?style=flat-square&color=D6AA67\"></a>\n  <a href=\"https://www.npmjs.com/package/@barissozudogru/healthcheck-gen\"><img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/@barissozudogru/healthcheck-gen?style=flat-square&color=D6AA67\"></a>\n  <a href=\"https://github.com/barissozudogru/healthcheck-gen/actions/workflows/ci.yml\"><img alt=\"CI\" src=\"https://github.com/barissozudogru/healthcheck-gen/actions/workflows/ci.yml/badge.svg\"></a>\n  <a href=\"./LICENSE\"><img alt=\"MIT license\" src=\"https://img.shields.io/badge/License-MIT-D6AA67?style=flat-square\"></a>\n</p>\n\n# healthcheck-gen\n\nGenerate Docker HEALTHCHECK instructions by analyzing your Dockerfile.\n\n`healthcheck-gen` reads your Dockerfile to detect the base image, framework, and exposed port. It generates a `HEALTHCHECK` instruction ready to paste into your `Dockerfile` or `docker-compose.yml`, and surfaces a minimal `/health` endpoint snippet for the detected framework. It chooses `wget` on Alpine, a built-in runtime probe for supported slim images, and `curl` on fuller images. It safely replaces existing `HEALTHCHECK` instructions in multi-stage builds and outputs plain Dockerfile syntax, Compose YAML, or JSON.\n\n[Tool page](https://petri-labs.org/tools/healthcheck-gen/) · [npm](https://www.npmjs.com/package/@barissozudogru/healthcheck-gen) · [Source](https://github.com/barissozudogru/healthcheck-gen)\n\n```bash\n# Install globally\nnpm install -g @barissozudogru/healthcheck-gen\n\n# Or run directly with npx\nnpx @barissozudogru/healthcheck-gen\n```\n\n## Supported Base Images\n\n| Base image | Health check strategy | Default port |\n|---|---|---|\n| `node` | Node `fetch` on slim images, otherwise `curl` or `wget` to `/health` | from `EXPOSE` or `3000` |\n| `python` | Python `urllib` on slim images, otherwise `curl` or `wget` to `/health` | from `EXPOSE` or `3000` |\n| `golang` / `golang:*-alpine` | `curl -f` or `wget` to `/health` | from `EXPOSE` or `3000` |\n| `postgres` / `postgres:*-alpine` | `pg_isready -U ${POSTGRES_USER:-postgres}` | `5432` |\n| `redis` / `redis:*-alpine` | `redis-cli ping` | `6379` |\n| `nginx` / `nginx:*-alpine` | `curl -f` or `wget` to `/` | `80` |\n\nAlpine variants are detected by inspecting the image tag for the string `alpine`. When found, `wget -q --spider` replaces `curl -f` since curl is not always present in Alpine-based images.\n\nFramework detection covers: Express, Fastify, Next.js, NestJS, FastAPI, Flask, Django, Gin, Fiber, and Echo. Each gets a matching `/health` endpoint snippet in the output.\n\n## Usage\n\n```\nhealthcheck-gen [options]\n```\n\nRun without arguments to analyze `./Dockerfile` in the current directory.\n\n## Options\n\n| Flag | Argument | Default | Description |\n|---|---|---|---|\n| `--dockerfile` | `<path>` | `./Dockerfile` | Path to the Dockerfile to analyze |\n| `--append` | - | - | Append the generated `HEALTHCHECK` to the Dockerfile (replaces any existing one) |\n| `--compose` | - | - | Print the equivalent `docker-compose.yml` healthcheck block |\n| `--json` | - | - | Output all results as JSON (useful for scripting and CI) |\n| `--none` | - | - | Generate `HEALTHCHECK NONE` to explicitly disable health checking |\n| `--interval` | `<duration>` | `30s` | Override the `--interval` timing parameter |\n| `--timeout` | `<duration>` | `5s` | Override the `--timeout` timing parameter |\n| `--retries` | `<n>` | `3` | Override the `--retries` count |\n| `--start-period` | `<duration>` | `10s` | Override the `--start-period` timing parameter |\n| `--help`, `-h` | - | - | Show help message |\n| `--version`, `-v` | - | - | Print version |\n\nDuration values accept the same format Docker does: `30s`, `1m30s`, `2m`, etc.\n\n## Example Output\n\nGiven a `Dockerfile` that starts with `FROM node:20-alpine` and `EXPOSE 3000`:\n\n```\nhealthcheck-gen analysis for /app/Dockerfile\n------------------------------------------------------------\n\nDetected\n  Base image  : node:20-alpine\n  App type    : node\n  Framework   : express\n  Port        : 3000\n\nHEALTHCHECK instruction\nHEALTHCHECK \\\n  --interval=30s \\\n  --timeout=5s \\\n  --start-period=10s \\\n  --retries=3 \\\n  CMD wget -q --spider http://localhost:3000/health || exit 1\n```\n\nRunning with `--compose` adds:\n\n```yaml\nservices:\n  your-service:\n    healthcheck:\n      test: [\"CMD-SHELL\", \"wget -q --spider http://localhost:3000/health || exit 1\"]\n      interval: 30s\n      timeout: 5s\n      start_period: 10s\n      retries: 3\n```\n\nRunning with `--compose` also prints a suggested `/health` endpoint snippet:\n\n```js\n// Express health endpoint\napp.get('/health', (req, res) => {\n  res.status(200).json({ status: 'ok', timestamp: new Date().toISOString() });\n});\n```\n\n### Verified excerpt from a real Dockerfile\n\nRunning the current release against the public `release-intel-mcp` Dockerfile detects its actual runtime and produces a probe that does not assume `curl` is installed. The final line below is shortened for readability:\n\n```text\nDetected\n  Base image  : node:22-slim\n  Framework   : express\n  Port        : 3000\n\nHEALTHCHECK CMD node -e \"fetch('http://localhost:3000/health')...\"\n```\n\nIf this saves you time, consider [starring the repository](https://github.com/barissozudogru/healthcheck-gen). It helps other developers find it.\n\n## More Usage Examples\n\nAnalyze a specific Dockerfile:\n\n```bash\nhealthcheck-gen --dockerfile ./docker/Dockerfile.prod\n```\n\nAppend the generated instruction directly to the Dockerfile:\n\n```bash\nhealthcheck-gen --append\n```\n\nPrint the Compose block alongside the instruction:\n\n```bash\nhealthcheck-gen --compose\n```\n\nAppend and print the Compose block together:\n\n```bash\nhealthcheck-gen --append --compose\n```\n\nOutput as JSON for use in scripts or CI pipelines:\n\n```bash\nhealthcheck-gen --json\n```\n\nDisable health checking entirely:\n\n```bash\nhealthcheck-gen --none --append\n```\n\nOverride all timing parameters:\n\n```bash\nhealthcheck-gen --interval 60s --timeout 10s --retries 5 --start-period 30s\n```\n\n## CI Integration\n\nUse the reusable action to generate a reviewable workflow summary without changing the Dockerfile:\n\n```yaml\nname: Health check review\n\non: [pull_request]\n\njobs:\n  healthcheck:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions/checkout@v4\n      - uses: barissozudogru/healthcheck-gen@v0.5.1\n        with:\n          dockerfile: Dockerfile\n```\n\nSet `append: true` only when the workflow should modify the checked-out Dockerfile. The action leaves committing or opening a pull request to the surrounding workflow so the diff remains explicit.\n\nUse `--json` to consume the output in a pipeline step:\n\n```yaml\n- name: Generate HEALTHCHECK\n  run: |\n    npx @barissozudogru/healthcheck-gen --json > healthcheck.json\n    cat healthcheck.json | jq '.dockerfileInstruction'\n```\n\nOr append directly during a Docker build preparation step:\n\n```yaml\n- name: Append HEALTHCHECK to Dockerfile\n  run: npx @barissozudogru/healthcheck-gen --append\n```\n\n## Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Dockerfile not found, parse error, or invalid arguments |\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"README.md"}