version: "3.7"
services:

  app:
    build:
      context: ./
      dockerfile: Dockerfile
    command: ["bash", "-c", "docker/init/app.sh && docker-php-entrypoint php-fpm"]
    container_name: tiba-app
    restart: unless-stopped
    working_dir: /var/www/html/
    environment:
      GITHUB_TOKEN: ${GITHUB_TOKEN}
    volumes:
      - ./:/var/www/html/
      - ./docker/php.ini:/usr/local/etc/php/conf.d/99-php.ini
    networks:
      - tiba-app


  nginx:
    image: nginx:alpine
    container_name: tiba-nginx
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./:/var/www/html/
      - ./docker/nginx:/etc/nginx/conf.d/
    depends_on:
      - db

    networks:
      - tiba-app

  db:
    image: mysql
    # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
    # (this is just an example, not intended to be a production configuration)
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
    networks:
      - tiba-app
networks:
  tiba-app:
    driver: bridge
