diff --git a/.drone.yml b/.drone.yml index e81d4d3..02a54e1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,12 @@ # DEPLOY kind: pipeline -name: dev +name: deploy trigger: status: - - success - branch: - - dev + - success + event: + - push steps: # @@ -28,7 +28,7 @@ steps: # - # Build the Node.js app + # Build Node.js app # - name: build-node image: node:latest @@ -40,19 +40,36 @@ steps: # # Build the Docker image # - - name: build-docker + # DEV + - name: build-docker-dev image: docker:latest volumes: - name: docker_sock path: /var/run/docker.sock commands: - docker build --pull --no-cache -t cetrucflotte/housesof:dev . + when: + branch: + - dev + + # PROD + - name: build-docker-prod + image: docker:latest + volumes: + - name: docker_sock + path: /var/run/docker.sock + commands: + - docker build --pull --no-cache -t cetrucflotte/housesof:latest . + when: + branch: + - master # # Restart container # - - name: restart + # DEV + - name: restart-container-dev image: appleboy/drone-ssh settings: host: flayks.com @@ -64,6 +81,26 @@ steps: - cd /data/sites/housesof.world/dev - docker-compose down - docker-compose up -d --remove-orphans + when: + branch: + - dev + + # PROD + - name: restart-container-prod + image: appleboy/drone-ssh + settings: + host: flayks.com + username: + from_secret: ssh_user + key: + from_secret: ssh_key + script: + - cd /data/sites/housesof.world/www + - docker-compose down + - docker-compose up -d --remove-orphans + when: + branch: + - master #