Ssh and cache.
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone Build was killed

This commit is contained in:
aminecmi 2022-08-06 15:53:09 +02:00
parent e0f48c99bd
commit 82c7b793c0

View File

@ -25,12 +25,13 @@ steps:
restore: true
mount:
- ./node_modules
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ]
- name: build
image: node:14
commands:
- npm install
- ls -la ./node_modules
- npm run lint
- npm run build:prod
environment:
@ -46,7 +47,7 @@ steps:
rebuild: true
mount:
- ./node_modules
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ]
trigger:
event:
@ -60,7 +61,7 @@ volumes:
---
kind: pipeline
type: docker
name: CopyToServer
name: Deploy
steps:
- name: restore-cache
@ -72,7 +73,7 @@ steps:
restore: true
mount:
- ./node_modules
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ]
- name: build
image: node:14
@ -93,33 +94,21 @@ steps:
port: 22
target: /home/ubuntu/courses
source: dist/*
trigger:
event:
- promote
target:
- production
---
kind: pipeline
type: ssh
name: Deploy
server:
host: amine-louveau.fr
user: ubuntu
ssh_key:
from_secret: ssh_key
steps:
- name: copy
commands:
- cd /home/ubuntu/courses
- mv dist/* ./
- sudo chown www-data:www-data ./*
- sudo rm -rf /var/www/amine/courses/*
- sudo mv ./* /var/www/amine/courses/
depends_on:
- CopyToServer
- name: deploy
image: appleboy/drone-ssh
settings:
host: amine-louveau.fr
user: ubuntu
key:
from_secret: ssh_key
command_timeout: 2m
script:
- cd /home/ubuntu/courses
- mv dist/* ./
- sudo chown www-data:www-data ./*
- sudo rm -rf /var/www/amine/courses/*
- sudo mv ./* /var/www/amine/courses/
trigger:
event:
- promote