|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +## Project overview |
| 4 | + |
| 5 | +Docker packaging for [draw.io](https://github.com/jgraph/drawio). Produces the `jgraph/drawio` and `jgraph/export-server` Docker images. |
| 6 | + |
| 7 | +## Repository structure |
| 8 | + |
| 9 | +- `main/` — Primary draw.io Docker image (Tomcat + draw.io WAR built from source) |
| 10 | + - `Dockerfile` — Multi-stage build: builds draw.io WAR with Ant, deploys to Tomcat 9 |
| 11 | + - `docker-entrypoint.sh` — Runtime configuration via environment variables (PreConfig.js / PostConfig.js generation, SSL setup, Tomcat context path) |
| 12 | +- `image-export/` — Export server image (Node.js + Puppeteer + Chrome for PDF/image export) |
| 13 | +- `self-contained/` — docker-compose for running draw.io with export server and all integrations |
| 14 | +- `nextcloud/` — docker-compose for Nextcloud integration with nginx reverse proxy |
| 15 | + |
| 16 | +## Key conventions |
| 17 | + |
| 18 | +- The main branch is `dev`. |
| 19 | +- Commit messages reference upstream issues as `[jgraph/drawio#NNN]` and docker-drawio issues as `[jgraph/docker-drawio#NNN]`. |
| 20 | +- Environment variables are the primary configuration mechanism. They are processed in `main/docker-entrypoint.sh` which generates JS config files injected into the draw.io webapp at container startup. |
| 21 | +- The upstream draw.io source is cloned at build time (not vendored). The WAR is built from `https://github.com/jgraph/drawio`. |
| 22 | + |
| 23 | +## Building and testing |
| 24 | + |
| 25 | +```bash |
| 26 | +# Build the main image |
| 27 | +docker build -t jgraph/drawio main/ |
| 28 | + |
| 29 | +# Build the export server image |
| 30 | +docker build -t jgraph/export-server image-export/ |
| 31 | + |
| 32 | +# Run locally |
| 33 | +docker run -it --rm -p 8080:8080 jgraph/drawio |
| 34 | + |
| 35 | +# Run self-contained (with export server) |
| 36 | +cd self-contained && docker-compose up |
| 37 | +``` |
| 38 | + |
| 39 | +## Environment variable patterns |
| 40 | + |
| 41 | +New environment variables should: |
| 42 | +1. Be documented in `README.md` under "Environment variables" |
| 43 | +2. Be processed in `main/docker-entrypoint.sh` |
| 44 | +3. Follow the `DRAWIO_*` naming convention for draw.io-specific settings |
| 45 | +4. Use shell defaults: `${VAR:-default_value}` |
0 commit comments