Files
housesof/.drone.yml
Félix Péault 567abe12c0
Some checks failed
continuous-integration/drone/push Build is failing
Update Drone email notification config
2020-10-03 14:26:43 +02:00

150 lines
2.7 KiB
YAML

# DEPLOY
kind: pipeline
name: deploy
trigger:
status:
- success
event:
- push
steps:
#
# Restore cache (node_modules, build, etc)
#
- name: cache-restore
image: meltwater/drone-cache:dev
pull: true
volumes:
- name: cache
path: /tmp/cache
settings:
backend: "filesystem"
restore: true
cache_key: "volume"
archive_format: "gzip"
mount:
- "node_modules"
#
# Build Node.js app
#
- name: build-node
image: node:latest
commands:
- yarn
- yarn build
#
# Build the Docker image
#
# 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
#
# DEV
- name: restart-container-dev
image: appleboy/drone-ssh
settings:
host: flayks.com
username:
from_secret: ssh_user
key:
from_secret: ssh_key
script:
- cd /data/sites/housesof.world/test
- 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
#
# Rebuild cache
#
- name: cache-rebuild
image: meltwater/drone-cache:dev
pull: true
volumes:
- name: cache
path: /tmp/cache
settings:
backend: "filesystem"
rebuild: true
cache_key: "volume"
archive_format: "gzip"
mount:
- "node_modules"
#
# Notify (by Email)
#
- name: notify-email
image: drillster/drone-email
settings:
host:
from_secret: notify_email_server
from:
from_secret: notify_email_address
username:
from_secret: notify_email_address
password:
from_secret: notify_email_password
recipients:
- hello@flayks.com
recipients_only: true
# Mount cache volume
volumes:
- name: cache
host:
path: /var/lib/cache
- name: docker_sock
host:
path: /var/run/docker.sock