# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.4.11

pipelines:
  branches:
    master:
      - step:
          caches:
            - composer
          script:
            - apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev
            - docker-php-ext-configure gd --with-freetype --with-jpeg
            - docker-php-ext-install -j$(nproc) gd
            - apt-get update && apt-get install -y libmemcached-dev zlib1g-dev
            - pecl install memcached
            - docker-php-ext-enable memcached
            - php -r "file_exists('.env') || copy('.env.example', '.env');"
            - apt-get update && apt-get install -y unzip libzip-dev
            - docker-php-ext-install zip
            - docker-php-ext-enable zip
            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
            - php artisan cache:clear
            - composer clear-cache
            - composer install
            # - php artisan key:generate
            - php artisan config:cache
            # - php artisan serve &
            # - sleep 5
    development:
      - step:
          caches:
            - composer
          script:
            - apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev
            - docker-php-ext-configure gd --with-freetype --with-jpeg
            - docker-php-ext-install -j$(nproc) gd
            - apt-get update && apt-get install -y libmemcached-dev zlib1g-dev
            - pecl install memcached
            - docker-php-ext-enable memcached
            - php -r "file_exists('.env') || copy('.env.example', '.env');"
            - apt-get update && apt-get install -y unzip libzip-dev
            - docker-php-ext-install zip
            - docker-php-ext-enable zip
            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
            - php artisan clear
            - composer install
            # - php artisan key:generate
            - php artisan config:cache
            # - php artisan serve &
            # - sleep 5
