
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: opticas-app
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    environment:
      - CI_ENVIRONMENT=development
      - database.default.hostname=db
      - database.default.database=optica_local
      - database.default.username=root
      - database.default.password=root
      - database.default.DBDriver=MySQLi
      - database.default.port=3306
    volumes:
      - ./:/app
      - caddy_data:/data
      - caddy_config:/config
    depends_on:
      - db
    restart: unless-stopped
    tty: true

  db:
    image: mysql:8.4
    container_name: local-database
    ports:
      - "3306:3306"
    environment:
      - MYSQL_DATABASE=optica_local
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - ad79e294d03b7f5d8c22b187ea3908722178c1d1a480c798590270d6e40d2545:/var/lib/mysql
    restart: unless-stopped
    
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: opticas-phpmyadmin
    ports:
      - "8080:80"
    environment:
      - PMA_HOST=db
      - PMA_PORT=3306
      - MYSQL_ROOT_PASSWORD=root
      - UPLOAD_LIMIT=512M
    volumes:
      - ./php.ini:/usr/local/etc/php/php.ini
    depends_on:
      - db
    restart: unless-stopped

volumes:
  ad79e294d03b7f5d8c22b187ea3908722178c1d1a480c798590270d6e40d2545:
    external: true
  caddy_data:
  caddy_config: