services:
  app:
    user: "${UID}:${GID}"
    build:
      args:
        user: alianca
        uid: "${UID}"
      context: ./
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/
    volumes:
      - ./:/var/www/
    networks:
      - alianca_network

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8282:80"
      - "443:443"
    volumes:
      - ./:/var/www/
      - ./docker/nginx/:/etc/nginx/conf.d/
    networks:
      - alianca_network

  # redis
  redis:
    image: redis:7.2
    command: redis-server --requirepass ${REDIS_PASSWORD}
    ports:
      - "6392:6379"
    networks:
      - alianca_network

  #queue
  queue:
    user: "${UID}:${GID}"
    build:
      args:
        user: alianca
        uid: "${UID}"
      context: ./
      dockerfile: Dockerfile
    restart: always
    command: "php artisan queue:work --tries=1 --timeout=30"
    volumes:
      - ./:/var/www
    depends_on:
      - redis
    networks:
      - alianca_network

  #horizon
  horizon:
    user: "${UID}:${GID}"
    build:
      args:
        user: alianca
        uid: "${UID}"
      context: ./
      dockerfile: Dockerfile
    restart: always
    command: "php artisan horizon"
    volumes:
      - ./:/var/www
    depends_on:
      - redis
    networks:
      - alianca_network

  mysql:
    image: mysql:5.7.22
    restart: unless-stopped
    ports:
      - "3307:3307"
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_TCP_PORT: 3307
    volumes:
      - ./.docker/mysql/dbdata:/var/lib/mysql
    networks:
      - alianca_network

networks:
  alianca_network:
    driver: bridge
