# Local development infrastructure only.
# Starts PostgreSQL and Redis so the backend/worker/frontend can run natively.
#
# Usage:
#   docker compose -f docker-compose.yml up -d
#   docker compose -f docker-compose.yml down
#
# For full Docker deployment (all services) use compose.yml instead.

services:

  db:
    image: postgres:16
    restart: unless-stopped
    ports:
      - "5433:5432"
    volumes:
      - db_data:/var/lib/postgresql/data/pgdata
    environment:
      - PGDATA=/var/lib/postgresql/data/pgdata
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changethis}
      - POSTGRES_DB=${POSTGRES_DB:-app}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-app}"]
      interval: 5s
      timeout: 3s
      retries: 10

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

  adminer:
    image: adminer
    restart: unless-stopped
    ports:
      - "8080:8080"
    depends_on:
      db:
        condition: service_healthy
    environment:
      - ADMINER_DESIGN=pepa-linha-dark

volumes:
  db_data:
  redis_data:
