kind: pipeline
type: docker
name: nodejs-22-docker-ci
#c
steps:
  - name: git-clone
    image: alpine/git
    commands:
      - git clone http://120.48.5.80:3000/lixin/automated_api.git
      - cd automated_api

  - name: build-docker-image
    image: docker:latest
    volumes:
      - name: docker-socket
        path: /var/run/docker.sock
    working_directory: automated_api
    commands:
      - docker build -t rz/automated_api:latest -f Dockerfile .

  - name: run-container
    image: docker:latest
    volumes:
      - name: docker-socket
        path: /var/run/docker.sock
    commands:
      - echo "Checking Docker version"
      - docker version
      - echo "Running container"
      - docker run -d -p 8001:8001 rz/automated_api:latest

trigger:
  branch:
    - main
  event:
    - push