# Deploy by: Armando Rojas <rojasarmando260@gmail.com>
image: lorisleiva/laravel-docker:7.3

options:
  max-time: 10

definitions:
  caches:
    vendor: vendor

pipelines:
  branches:
    development:
      - step:
          name: Build
          caches:
            - composer
            - node
            - vendor
          script:
            - apt-get update && apt-get install -qy git curl libmcrypt-dev ghostscript autoconf
            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

            - composer update
            # - vendor/bin/phpunit
      - step:
          name: Deploy
          script:
            - pipe: atlassian/scp-deploy:1.0.1
              variables:
                USER: 'root'
                SERVER: 'dev.cronapis.com'
                REMOTE_PATH: '/var/www/html/fe'
                LOCAL_PATH: './*'
            - pipe: atlassian/ssh-run:0.2.2
              variables:
                SSH_USER: 'root'
                SERVER: 'dev.cronapis.com'
                COMMAND: 'cd /var/www/html/fe && composer install && php artisan migrate'
