stages:
  - build
  - deploy

build-dev:
  stage: build
  tags:
    - shared
  image: docker:24.0
  script:
    - echo "Logging in to private registry..."
    - docker login -u "$DEPLOY_USERNAME" -p "$DEPLOY_TOKEN" 103.82.242.92:8900
    - echo "Building image..."
    - docker build -t 103.82.242.92:8900/medols/web-asuransi-aman:dev .
    - echo "Pushing image..."
    - docker push 103.82.242.92:8900/medols/web-asuransi-aman:dev

auto-deploy:
  stage: deploy
  tags:
    - shared
  image: curlimages/curl:latest
  script:
    - echo "Triggering Jenkins job..."
    - curl --user admin:$JENKINS_PWD "http://38.47.180.165:8080/job/auto-deploy-asuransi-aman/build?token=autodeploymedols"
