Use non-sudo user for CI/CD
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sam A. 2023-01-14 00:18:57 +01:00
parent 5de80c144f
commit 07218e7b5b
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -15,22 +15,16 @@ steps:
- name: deploy - name: deploy
image: alpine/git:latest image: alpine/git:latest
environment: environment:
SSH_USER:
from_secret: ssh_user
SSH_HOST:
from_secret: ssh_host
SSH_PORT:
from_secret: ssh_port
SSH_KEY: SSH_KEY:
from_secret: ssh_key from_secret: ssh_key
commands: commands:
- mkdir ~/.ssh - mkdir ~/.ssh
- echo "$${SSH_KEY}" > ~/.ssh/id_ed25519 - echo "$${SSH_KEY}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519
- ssh -o "StrictHostKeyChecking no" -p $${SSH_PORT} - ssh -o "StrictHostKeyChecking no"
$${SSH_USER}@$${SSH_HOST} "rm -rf docker/nginx/website/public/*" cicd@cpx.servers.sapti.me "rm -rf /opt/apps/nginx/website/public/*"
- scp -o "StrictHostKeyChecking no" -P $${SSH_PORT} -r - scp -o "StrictHostKeyChecking no" -r
./public $${SSH_USER}@$${SSH_HOST}:docker/nginx/website ./public cicd@cpx.servers.sapti.me:/opt/apps/nginx/website
when: when:
branch: branch:
- main - main