Docker Deployment
Better Reports includes a production-ready Docker setup.
Quick Start
bash
# Clone the repository
git clone https://github.com/dlampatricio/better-reports.git
cd better-reports
# Start with Docker Compose
docker compose up -dOr use the included Makefile:
bash
make build # Build the Docker image
make start # Start the container
make logs # View logs
make stop # Stop the container
make clean # Remove volumes and imagesDocker Compose Configuration
yaml
services:
app:
build: .
environment:
- NODE_ENV=production
- REPORTS_PORT=3000
- REPORTS_USER=admin
- REPORTS_PASS=${REPORTS_PASS}
- REPORTS_CORS_ORIGIN=https://reports.yourdomain.com
- REPORTS_TEMPLATES_DIR=/data/templates
- REPORTS_ASSETS_DIR=/data/assets
- REPORTS_FONTS_DIR=/data/fonts
volumes:
- templates_data:/data/templates
- assets_data:/data/assets
- packages_cache:/app/.packages
- fonts_data:/data/fonts
ports:
- "3000:3000"
volumes:
templates_data:
assets_data:
packages_cache:
fonts_data:Multi-stage Dockerfile
The Dockerfile uses a 3-stage build:
- Rust build stage � Compiles the native Typst addon
- UI build stage � Builds the React frontend with Vite
- Runtime stage � Minimal
node:22-slimimage with compiled artifacts
Entrypoint
The entrypoint.sh script creates the required runtime directories on container start:
/data/templates/data/assets/data/fonts/app/.packages
Health Checks
Docker health checks use the /api/health endpoint (no auth required):
yaml
healthcheck:
test: ["CMD", "node", "scripts/health-check.mjs"]
interval: 30s
timeout: 5s
retries: 3Environment Variables
| Variable | Description |
|---|---|
REPORTS_USER | Basic auth username |
REPORTS_PASS | Basic auth password |
REPORTS_CORS_ORIGIN | Allowed CORS origin |
REPORTS_TEMPLATES_DIR | Template storage path |
REPORTS_ASSETS_DIR | Asset storage path |
REPORTS_FONTS_DIR | Custom fonts path |
Security Headers
The server includes built-in security headers:
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 0Referrer-Policy: strict-origin-when-cross-origin