services:
  app:
    image: php:8.3-fpm-alpine
    working_dir: /var/www
    volumes: ['./:/var/www']
    depends_on: [postgres, redis]
    command: sh -c "apk add --no-cache postgresql-dev libpq && docker-php-ext-install pdo pdo_pgsql && php -S 0.0.0.0:8000 -t public"
    ports: ['8000:8000']
    environment:
      DB_HOST: postgres
      REDIS_HOST: redis
  postgres:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: nfe_saas
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes: ['pgdata:/var/lib/postgresql/data', './database/sql:/docker-entrypoint-initdb.d']
    ports: ['5432:5432']
  redis:
    image: redis:7-alpine
    ports: ['6379:6379']
volumes:
  pgdata:
