services:
  postgres:
    image: postgres:16-alpine
    container_name: mocl-pg
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${PGUSER:-mocl}
      POSTGRES_PASSWORD: ${PGPASSWORD:-change-me}
      POSTGRES_DB: ${PGDATABASE:-mocl}
    ports:
      - "${PGPORT:-5432}:5432"
    volumes:
      - mocl-pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${PGUSER:-mocl}"]
      interval: 5s
      timeout: 3s
      retries: 10

  redis:
    image: redis:7-alpine
    container_name: mocl-redis
    restart: unless-stopped
    ports:
      - "${REDIS_PORT:-6379}:6379"
    volumes:
      - mocl-redisdata:/data

  adminer:
    image: adminer:latest
    container_name: mocl-adminer
    restart: unless-stopped
    ports:
      - "8080:8080"
    depends_on:
      - postgres

volumes:
  mocl-pgdata:
  mocl-redisdata:
