services:
  app:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: tkbills-app
    restart: unless-stopped
    working_dir: /var/www/html
    volumes:
      - .:/var/www/html
      - ./storage:/var/www/html/storage
    depends_on:
      - redis
    networks:
      - tkbills

  nginx:
    build:
      context: .
      dockerfile: docker/nginx/Dockerfile
    container_name: tkbills-nginx
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/html
      - ./storage:/var/www/html/storage
    depends_on:
      - app
    networks:
      - tkbills

  redis:
    image: redis:alpine
    container_name: tkbills-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    networks:
      - tkbills

  db:
    image: mysql:8.0
    container_name: tkbills-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: tkbills
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_USER: tkbills
      MYSQL_PASSWORD: secret
    ports:
      - "3306:3306"
    volumes:
      - tkbills-db-data:/var/lib/mysql
    networks:
      - tkbills

volumes:
  tkbills-db-data:

networks:
  tkbills:
    driver: bridge
