|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Project overview |
| 4 | + |
| 5 | +The official Pi-hole Docker image. It packages FTL, the core scripts and the web interface into a single container, with startup logic that translates environment variables into Pi-hole configuration. |
| 6 | + |
| 7 | +## Repository layout |
| 8 | + |
| 9 | +- `src/Dockerfile` - the image definition |
| 10 | +- `src/start.sh` - container entrypoint |
| 11 | +- `src/bash_functions.sh` - startup logic (environment variable handling, configuration conversion) |
| 12 | +- `src/crontab.txt` - scheduled in-container jobs |
| 13 | +- `build.sh` - local image build helper |
| 14 | +- `test/` - BATS test suite and `test/run.sh` harness |
| 15 | +- `examples/` - example compose files and deployment configurations |
| 16 | + |
| 17 | +## Dev environment tips |
| 18 | + |
| 19 | +- You need Docker and git; everything builds and runs in containers. |
| 20 | +- Build a local image with `./build.sh`. |
| 21 | +- The image is published for multiple architectures; avoid amd64-only assumptions in the Dockerfile or scripts. |
| 22 | + |
| 23 | +## Testing instructions |
| 24 | + |
| 25 | +- Run the suite with `bash test/run.sh`. It builds `pihole:test`, starts one container per configuration under test, runs BATS against them, and cleans up on exit. |
| 26 | +- See `test/TESTING.md` for details, including testing other platforms via emulation: `CIPLATFORM=linux/arm64 bash test/run.sh` |
| 27 | +- Any change to startup behaviour or environment variable handling needs a corresponding BATS test. |
| 28 | + |
| 29 | +## PR instructions |
| 30 | + |
| 31 | +- Base all work on the `development` branch; pull requests target `development`. |
| 32 | +- Read the [contributors guide](https://docs.pi-hole.net/guides/github/contributing/) |
| 33 | +- Every commit must be signed off (DCO): use `git commit -s`. |
| 34 | +- Run `bash test/run.sh` before committing. |
| 35 | +- Use Unix line endings (LF); shell scripts in this image run under the container's shell, not Windows. |
| 36 | +- Code is licensed under the EUPL 1.2; contributions must be compatible. |
| 37 | +- Environment variables are the public interface of this image. Document any new or changed variable in the README, and keep backwards compatibility unless a break is explicitly agreed. |
| 38 | +- Stability comes before features; this image runs unattended on many systems. |
| 39 | +- The correct project spelling is "Pi-hole" (capital P, lowercase h, hyphen). |
| 40 | + |
| 41 | +## Security considerations |
| 42 | + |
| 43 | +- Secrets can be supplied via Docker secrets as well as environment variables; never log their values during startup. |
| 44 | +- Be deliberate about container capabilities and dropped privileges; do not add capability requirements without discussion. |
| 45 | +- If you believe you have found a vulnerability, do not open a public issue or PR; report it privately per the organisation's security policy (disclosure@pi-hole.net). |
| 46 | + |
| 47 | +## Common pitfalls |
| 48 | + |
| 49 | +- Changing environment variable behaviour without updating the README and tests. |
| 50 | +- Adding packages to the image without considering size and multi-arch availability. |
| 51 | +- Forgetting the DCO sign-off on commits. |
| 52 | +- Assuming host paths or Docker Desktop specifics; the image must work on plain Linux Docker and compose. |
0 commit comments