version: "3.9"

services:
  app:
    image: php:8.3-apache
    ports:
      - "8080:80"
    volumes:
      - ./public:/var/www/html
      - ./src:/var/www/src
      - ./views:/var/www/views
      - ./sql:/var/www/sql
      - ./.env:/var/www/.env
    environment:
      - DB_HOST=db
      - DB_PORT=5432
      - DB_NAME=pulse_launch
      - DB_USER=postgres
      - DB_PASS=password
    depends_on:
      - db
      - redis
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: pulse_launch
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./sql/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
    ports:
      - "5432:5432"
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    restart: unless-stopped

volumes:
  pgdata:
