kind: pipeline
type: docker
name: build-and-push

trigger:
  branch:
    - main
    - develop
  event:
    - push

steps:
  # 构建并推送后端镜像
  - name: build-push-backend
    image: plugins/docker
    settings:
      registry:
        from_secret: docker_registry
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
      repo: crpi-na6dit5kd0bonqed.cn-guangzhou.personal.cr.aliyuncs.com/ireborn/ai-interview-backend
      dockerfile: deploy/Dockerfile.backend
      tags:
        - latest
        - ${DRONE_BRANCH}
        - ${DRONE_COMMIT_SHA:0:8}

  # 构建并推送前端镜像
  - name: build-push-frontend
    image: plugins/docker
    settings:
      registry:
        from_secret: docker_registry
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
      repo: crpi-na6dit5kd0bonqed.cn-guangzhou.personal.cr.aliyuncs.com/ireborn/ai-interview-frontend
      dockerfile: deploy/Dockerfile.frontend
      tags:
        - latest
        - ${DRONE_BRANCH}
        - ${DRONE_COMMIT_SHA:0:8}
