kind: pipeline
type: docker
name: CD_pipeline

trigger:
  event:
    - push

steps:
  # docker image build
  - name: docker-build-and-push
    image: plugins/docker
    settings:
       dockerfile: Dockerfile
       context: ./
       registry: hub.codefirst.iut.uca.fr
       repo: hub.codefirst.iut.uca.fr/othmane.benjelloun/othmane-benjelloun
       username:
         from_secret: SECRET_REGISTRY_USERNAME
       password:
         from_secret: SECRET_REGISTRY_PASSWORD

  - name: deploy-container
    image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
    environment:
        IMAGENAME: hub.codefirst.iut.uca.fr/othmane.benjelloun/othmane-benjelloun:latest
        CONTAINERNAME: portfolio
        COMMAND: create
        OVERWRITE: true