language: bash
services: docker

env:
  - PACKAGE=php VERSION=php-7.1-fpm
  - PACKAGE=php VERSION=php-7.2-fpm
  - PACKAGE=php VERSION=php-7.3-fpm
  - PACKAGE=php VERSION=php-7.3-swoole

before_script:
  - env | sort
  - cd "$PACKAGE"

script:
  - |
    (
      set -Eeuo pipefail
      set -x
      docker build --pull --file "$VERSION" --tag "xtreamwayz/$PACKAGE:$VERSION" --cache-from "xtreamwayz/$PACKAGE:$VERSION" .
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php --version
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php --ini
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php -m
    )

after_script:
  - docker images

before_deploy:
  - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"

deploy:
  provider: script
  script: docker push "xtreamwayz/$PACKAGE:$VERSION"
  on:
    branch: master
    
language: bash
services: docker

env:
  - PACKAGE=php VERSION=php-7.1-fpm
  - PACKAGE=php VERSION=php-7.2-fpm
  - PACKAGE=php VERSION=php-7.3-fpm

before_script:
  - env | sort
  - cd "$PACKAGE"

script:
  - |
    (
      set -Eeuo pipefail
      set -x
      docker build --pull --file "$VERSION" --tag "xtreamwayz/$PACKAGE:$VERSION" --cache-from "xtreamwayz/$PACKAGE:$VERSION" .
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php --version
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php --ini
      docker run -ti --rm "xtreamwayz/$PACKAGE:$VERSION" php -m
    )

after_script:
  - docker images

before_deploy:
  - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"

deploy:
  provider: script
  script: docker push "xtreamwayz/$PACKAGE:$VERSION"
  on:
    branch: master

Remove swool build for now
Remove swool build for now
