image: php:8.0-fpm

pipelines:
  default:
    - step:
        script:
          - apt-get update && apt-get install -qy git curl libmcrypt-dev default-mysql-client libzip-dev libpng-dev
          - yes | pecl install mcrypt-1.0.4
          - docker-php-ext-install pdo_mysql zip bcmath pcntl gd
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          - ln -f -s .env.pipelines .env
          - php artisan migrate
          - php artisan serve &
          - sleep 5
          - curl -vk http://localhost:8000
          - php artisan test 
        services:
          - mysql
          - docker
        caches:
          - composer
          - node

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: 'homestead'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: 'homestead'
        MYSQL_PASSWORD: 'secret'