version: "3.1"

services:
  webserver:
    image: nginx:alpine
    working_dir: /application
    volumes:
      - ..:/application
      - ./webserver/nginx.conf:/etc/nginx/conf.d/default.conf
    ports:
      - "8000:80"

  php-fpm:
    environment:
      - TERM_PROGRAM=Hyper  # force colors for the symfony dumper
    build:
      context: php-fpm
    working_dir: /application
    volumes:
      - ..:/application
      - ./php-fpm/php-ini-overrides.ini:/etc/php/7.3/fpm/conf.d/99-overrides.ini
      - ./php-fpm/php-fpm-overrides.conf:/etc/php/7.3/fpm/pool.d/z-overrides.conf

  queue-worker:
    environment:
      - TERM_PROGRAM=Hyper  # force colors for the symfony dumper
    build:
      context: php-fpm
    working_dir: /application
    entrypoint: sudo supervisord -c /etc/supervisor/conf.d/queue-worker.conf
    volumes:
      - ./php-fpm/queue-worker.conf:/etc/supervisor/conf.d/queue-worker.conf
      - ..:/application
      - ./php-fpm/php-ini-overrides.ini:/etc/php/7.3/cli/conf.d/99-overrides.ini

  redis:
    image: "redis"
    entrypoint: redis-server --save 60 1 --loglevel warning
    volumes:
      - redis-data:/data

  redis-commander:
    image: "rediscommander/redis-commander"
    environment:
      - REDIS_HOST=redis
    ports:
      - "8101:8081"

  mariadb:
    image: mariadb:10.3
    volumes:
      - mariadb-data:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=db
      - MYSQL_USER=user
      - MYSQL_PASSWORD=secret
      - MYSQL_ROOT_PASSWORD=root-secret

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      - PMA_USER=db
      - PMA_PASSWORD=secret
      - PMA_HOSTS=mariadb
    ports:
      - "8102:80"

volumes:
  mariadb-data:
  redis-data: