variables:
  VERSION: ${CI_COMMIT_TAG}

before_script:
  - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY

l3d-script:
  stage: build
  script: sed -i -e "s/'{{ version }}'/${VERSION}/g" l3d
  artifacts:
    name: l3d
    paths:
      - l3d
  only:
    - tags

php-7.0:
  stage: build
  script:
    - docker build --pull --build-arg PHP_VERSION=7.0 --build-arg VERSION=${VERSION} -t ${CI_REGISTRY_IMAGE}/php-7.0:${VERSION} .
    - docker push ${CI_REGISTRY_IMAGE}/php-7.0:${VERSION}
  only:
    - tags

php-7.1:
  stage: build
  script:
    - docker build --pull --build-arg PHP_VERSION=7.1 --build-arg VERSION=${VERSION} -t ${CI_REGISTRY_IMAGE}/php-7.1:${VERSION} .
    - docker push ${CI_REGISTRY_IMAGE}/php-7.1:${VERSION}
  only:
    - tags

php-7.2:
  stage: build
  script:
    - docker build --pull --build-arg PHP_VERSION=7.2 --build-arg VERSION=${VERSION} -t ${CI_REGISTRY_IMAGE}/php-7.2:${VERSION} .
    - docker push ${CI_REGISTRY_IMAGE}/php-7.2:${VERSION}
  only:
    - tags