version: "3.9"

services:
  web:
    image: 10.66.88.208:5000/blogpostai:latest
    container_name: blogpostai_web
    ports:
      - "8080:80"
    volumes:
      - ./logs:/var/log/apache2
    env_file:
      - .env
    environment:
      - TZ=Asia/Taipei
    depends_on:
      - db
    networks:
      - blogpostai_network
    restart: unless-stopped

  db:
    image: mysql:8.4
    container_name: blogpostai_db
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=blogpostai_db
      - MYSQL_USER=blogpostai_user
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - TZ=Asia/Taipei
    volumes:
      - db_data:/var/lib/mysql
      - ./sql:/docker-entrypoint-initdb.d
    networks:
      - blogpostai_network
    restart: unless-stopped

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: blogpostai_pma
    ports:
      - "8081:80"
    environment:
      - PMA_HOST=db
      - PMA_USER=blogpostai_user
      - PMA_PASSWORD=${MYSQL_PASSWORD}
      - UPLOAD_LIMIT=256M
      - PMA_ARBITRARY=0
    depends_on:
      - db
    networks:
      - blogpostai_network
    restart: unless-stopped

volumes:
  db_data:
    driver: local

networks:
  blogpostai_network:
    driver: bridge
