# This file is a template, and might need editing before it works on your project.
# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny
# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template.

stages:
  - build
  - deployontarget
  - cleanupcache

imageBuild:
  stage: build
  only:
   - development
  script:
    - ssh -P root@168.192.102.172 "cd /opt/toko-emas/$CI_PROJECT_NAME &&
                                   git pull && git checkout development && cd .. &&
                                   docker-compose build --no-cache $CI_PROJECT_NAME"

deployOnTarget:
  stage: deployontarget
  only:
   - development
  script:
    - ssh -P root@168.192.102.172 "cd /opt/toko-emas && docker-compose up -d $CI_PROJECT_NAME"

cleanupCache:
  stage: cleanupcache
  only:
   - development
  script:
    - ssh -P root@168.192.102.172 "docker system prune -f"
