version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: banking-system-app
    restart: unless-stopped
    volumes:
      - ./:/var/www/html
    networks:
      - banking-system-network

  webserver:
    image: nginx:alpine
    container_name: banking-system-webserver
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - banking-system-network
    depends_on:
      - app

  db:
    image: mysql:5.7
    container_name: banking-system-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: banking_system
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: secret
      MYSQL_USER: banking_user
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    ports:
      - "3306:3306"
    volumes:
      - banking-system-dbdata:/var/lib/mysql
    networks:
      - banking-system-network

networks:
  banking-system-network:
    driver: bridge

volumes:
  banking-system-dbdata:
    driver: local
