stages:
  - build
  - deploy

build-dev:
  stage: build
  when: on_success
  only:
    - main
  image:
    name: docker:25.0.3-cli
  services:
    - name: docker:25.0.3-dind
      command: ["--insecure-registry=38.47.185.86:8900"]
  script:
    - docker logout
    - docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 38.47.185.86:8900
    - docker build -t 38.47.185.86:8900/medols/web-isu-kini:dev .
    - docker push 38.47.185.86:8900/medols/web-isu-kini:dev

auto-deploy:
  stage: deploy
  when: on_success
  only:
    - main
  image: curlimages/curl:latest
  services:
    - docker:dind
  script:
    - curl --user admin:$JENKINS_PWD http://38.47.185.86:8080/job/auto-deploy-isu-kini/build?token=autodeploymedols
