Newer
Older
bugtrail / docker-compose.prod.yml
# Production stack: caddy (static panel + /api proxy) + server + postgres.
# Build the web panel first:  npm run build -w @ltt/web
services:
  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: ltt
      POSTGRES_PASSWORD: ltt
      POSTGRES_DB: ltt
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ltt"]
      interval: 2s
      timeout: 3s
      retries: 15

  server:
    build: ./server
    environment:
      DATABASE_URL: postgresql+asyncpg://ltt:ltt@postgres:5432/ltt
      FILES_DIR: /srv/data/files
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - ./data:/srv/data

  caddy:
    image: caddy:2-alpine
    ports:
      - "8081:80" # panel + API on http://host:8081
    volumes:
      - ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro
      - ./packages/web/dist:/srv/web:ro
      - caddy_data:/data
    depends_on:
      - server

volumes:
  postgres_data:
  caddy_data: