Use Drone to deploy on server

This commit is contained in:
2020-02-29 11:20:41 +01:00
parent 6019017596
commit 70ce97e9bc
2 changed files with 117 additions and 0 deletions

108
.drone.yml Normal file
View File

@@ -0,0 +1,108 @@
# PRODUCTION (on master)
kind: pipeline
name: dev
when:
branch: dev
status: [ success ]
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 the Node.js app
#
- name: build-node
image: node:latest
commands:
- npm install -s
- npm run build
#
# Build the Docker image
#
- name: build-docker
image: docker:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker build --pull --no-cache -t cetrucflotte/housesof:dev .
#
# Restart container
#
- name: restart
image: appleboy/drone-ssh
settings:
host: flayks.com
username:
from_secret: ssh_user
key:
from_secret: ssh_key
script:
- cd /data/sites/housesof.world/dev
- docker-compose up -d --force-recreate --remove-orphans
#
# 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:
# skip_verify: true
# host: mail.flayks.com
# username: admin@flayks.com
# password:
# from_secret: notify_email_password
# from: admin@flayks.com
# recipients:
# - bonjour@shelbykay.dev
# - admin@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