kind: pipeline
type: ssh
name: push

server:
  host:
    from_secret: ssh_host
  user:
    from_secret: ssh_user
  ssh_key:
    from_secret: ssh_key


steps:

- name: Stop and destroy old container
  failure: ignore
  commands:
    - docker ps -a | grep nexus-timers | awk '{system ("docker stop " $1); system ("docker rm " $1)}'

- name: Build new image
  commands:
  - git checkout test
  - docker build . -f Dockerfile.production --tag="nexus-timers"

- name: Launch new container
  commands:
  - docker run -p 7000:80 -d nexus-timers

trigger:
  branch:
  - test
