version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: dnsblock-app
    container_name: dnsblock-app
    restart: unless-stopped
    ports:
      - "8001:80"
    env_file:
      - .env
    volumes:
      - ./:/var/www/html
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    networks:
      - dnsblock-network
    depends_on:
      - db

  db:
    image: mysql:8.0
    container_name: dnsblock-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
      MYSQL_PASSWORD: ${DB_PASS}
      MYSQL_USER: ${DB_USER}
    volumes:
      - dbdata:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    networks:
      - dnsblock-network
    ports:
      - "3306:3306"

networks:
  dnsblock-network:
    driver: bridge

volumes:
  dbdata:
