kind: pipeline type: docker name: "CI/CD" steps: - image: mcr.microsoft.com/dotnet/sdk:8.0 name: "Run Tests" commands: - dotnet test - image: plugins/docker name: "build and push docker image" depends_on: - "Run Tests" settings: dockerfile: ci/API.dockerfile context: . registry: hub.codefirst.iut.uca.fr repo: hub.codefirst.iut.uca.fr/maxime.batista/iqball-api-dotnet tags: - ${DRONE_BRANCH/\//_} username: from_secret: SECRET_REGISTRY_USERNAME password: from_secret: SECRET_REGISTRY_PASSWORD # deploy staging database and server on codefirst - image: eeacms/rsync:latest name: "Instantiate docker images on staging server" depends_on: - "build and push docker image" environment: PRIVATE_KEY: from_secret: PRIVATE_KEY commands: - mkdir -p ~/.ssh - echo "$PRIVATE_KEY" > ~/.ssh/id_rsa - chmod 0600 ~/.ssh - chmod 0500 ~/.ssh/id_rsa* - rsync -avz -e "ssh -p 80 -o 'StrictHostKeyChecking=no'" ci/deploy_staging_server.sh iqball@maxou.dev:/srv/www/iqball/$DRONE_BRANCH/ - ssh -p 80 -o 'StrictHostKeyChecking=no' iqball@maxou.dev "chmod +x /srv/www/iqball/$DRONE_BRANCH/deploy_staging_server.sh && /srv/www/iqball/$DRONE_BRANCH/deploy_staging_server.sh $(echo $DRONE_BRANCH | tr / _) $DRONE_COMMIT_SHA" # Deploy the production database and server on codefirst # - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest # name: "Instantiate dotnet api docker image on codefirst" # depends_on: # - "build and push docker image" # environment: # IMAGENAME: hub.codefirst.iut.uca.fr/maxime.batista/iqball-api-dotnet:master # CONTAINERNAME: iqball_production_dotnet_webserver # OVERWRITE: true # COMMAND: create # # CODEFIRST_CLIENTDRONE_ENV_PGSQL_DSN: # from_secret: POSTGRES_DSN # ADMINS: maximebatista # # - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest # name: "Instantiate pgsql database docker image on codefirst" # depends_on: # - "build and push docker image" # environment: # IMAGENAME: postgres # CONTAINERNAME: iqball_production_database # COMMAND: create # # CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD: # from_secret: POSTGRES_PASSWORD # CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER: # from_secret: POSTGRES_USER # CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: # from_secret: POSTGRES_DB # ADMINS: maximebatista