version: '3.8'

services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: saasinfo_php
    working_dir: /var/www/html
    volumes:
      - .:/var/www/html
    depends_on:
      - db
      - redis
    networks:
      - saasinfo_network

  nginx:
    image: nginx:alpine
    container_name: saasinfo_nginx
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
    networks:
      - saasinfo_network

  db:
    image: mysql:8.0
    container_name: saasinfo_mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: saasinfo
      MYSQL_USER: saasinfo
      MYSQL_PASSWORD: saasinfo
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - saasinfo_network

  redis:
    image: redis:alpine
    container_name: saasinfo_redis
    ports:
      - "6380:6379"
    networks:
      - saasinfo_network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: saasinfo_phpmyadmin
    environment:
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: root
    ports:
      - "8081:80"
    depends_on:
      - db
    networks:
      - saasinfo_network

###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-16}-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    volumes:
      - database_data:/var/lib/postgresql/data:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###

volumes:

###> doctrine/doctrine-bundle ###
  database_data:
###< doctrine/doctrine-bundle ###
  db_data:

networks:
  saasinfo_network:
    driver: bridge

