version: '3.4'
  
services:
    test: 
        build:
            context: .
            target: ospos_test
        depends_on: 
          - mysql
        container_name: ospos_test
        environment:
          - CI_ENV=testing
          - ENCRYPTION_KEY=
          - MYSQL_HOST_NAME=mysql
          - MYSQL_DATABASE=ospos
          - MYSQL_USERNAME=admin
          - MYSQL_PASSWORD=pointofsale
        command: ["/bin/wait-for-it.sh", "mysql:3306", "--", "/app/vendor/phpunit/phpunit/phpunit"]
        ports:
          - "80:80"

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