kind: pipeline type: docker name: "CI and deploy on iqball.maxou.dev" steps: - image: mcr.microsoft.com/dotnet/sdk:8.0 name: "CI" commands: - dotnet test - image: plugins/docker name: "build and push docker image" depends_on: - "CI" 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 $DRONE_BRANCH" # 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