version: "3.4"

  services:
    app:
      image: monica:apache
      depends_on:
        - db
      ports:
        - 8080:80
      environment:
        - DB_HOST=db
        - DB_USERNAME=monica
        - DB_PASSWORD=supersecret
      volumes:
        - data:/var/www/html/storage
      restart: always
    db:
      image: mariadb:latest
      environment:
        - MARIADB_RANDOM_ROOT_PASSWORD=true
        - MARIADB_DATABASE=monica
        - MARIADB_USER=monica
        - MARIADB_PASSWORD=supersecret
      volumes:
        - /Users/yourUserName/workspace/monica-docker/mysql:/var/lib/mysql
      restart: always

  volumes:
    data:
      name: data
    mysql:
      name: mysql