version: '2'

volumes:
    uploads:
        driver: local
  
services:
    sqlscript:
        build:
            context: database/
            dockerfile: Dockerfile

    ospos:
        build:
            context: .
            dockerfile: Dockerfile.dev
        container_name: ospos
        restart: always
        depends_on:
          - mysql
        ports:
          - "80:80"
        volumes:
          - .:/app
        environment:
          - PHP_TIMEZONE=UTC
          - MYSQL_USERNAME=admin
          - MYSQL_PASSWORD=pointofsale
          - MYSQL_DB_NAME=ospos
          - MYSQL_HOST_NAME=mysql
          - XDEBUG_CONFIG=remote_host=172.17.0.1

    mysql:
        image: mariadb:10.1.21
        container_name: mysql
        restart: always
        ports:
          - "3306:3306"
        volumes_from:
          - sqlscript
        environment:
          - MYSQL_ROOT_PASSWORD=pointofsale
          - MYSQL_DATABASE=ospos
          - MYSQL_USER=admin
          - MYSQL_PASSWORD=pointofsale
