version: '2'
  
services:
    test: 
        build:
            context: .
            dockerfile: Dockerfile.test

    sqlscript:
        build:
            context: database/
            dockerfile: Dockerfile

    ospos:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: ospos
        restart: always
        depends_on:
          - mysql
        ports:
          - "80:80"
        environment:
          - MYSQL_USERNAME=admin
          - MYSQL_PASSWORD=pointofsale
          - MYSQL_DB_NAME=ospos
          - MYSQL_HOST_NAME=mysql

    mysql:
        image: mysql:5.7
        container_name: mysql
        restart: always
        ports:
          - "3306:3306"
        volumes:
          - ./database/database.sql:/docker-entrypoint-initdb.d/database.sql
        environment:
          - MYSQL_ROOT_PASSWORD=pointofsale
          - MYSQL_DATABASE=ospos
          - MYSQL_USER=admin
          - MYSQL_PASSWORD=pointofsale
