Skip to content

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 -d

Or 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 images

Docker 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:

  1. Rust build stage � Compiles the native Typst addon
  2. UI build stage � Builds the React frontend with Vite
  3. Runtime stage � Minimal node:22-slim image 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: 3

Environment Variables ​

VariableDescription
REPORTS_USERBasic auth username
REPORTS_PASSBasic auth password
REPORTS_CORS_ORIGINAllowed CORS origin
REPORTS_TEMPLATES_DIRTemplate storage path
REPORTS_ASSETS_DIRAsset storage path
REPORTS_FONTS_DIRCustom fonts path

Security Headers ​

The server includes built-in security headers:

  • X-Content-Type-Options: nosniff
  • X-Frame-Options: DENY
  • X-XSS-Protection: 0
  • Referrer-Policy: strict-origin-when-cross-origin

Design and Dev by David Lam