Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy docker-compose solution automatically from github to vps over ssh?

What I want to do: Deploy docker-compose solution from Github to my virtual private server which has docker and docker-compose installed.

I saw that there are Github Actions that allow me to copy files over SSH after push to master, but I don't know how to run docker-compose up on my server after source has been copied.

On my VPS I have Ubuntu 18.4 installed.

like image 759
Tomasz Sikora Avatar asked Mar 04 '23 03:03

Tomasz Sikora


1 Answers

I believe Github actions also allow you to run arbitrary commands on remote servers via ssh (there are a few in their library).

Assuming you copy your docker-compose.yml into, /home/user/app/docker-compose.yml, you could run a command like so:

ssh [email protected] "cd /home/user/app/ && docker-compose up -d"
like image 72
timur Avatar answered Mar 06 '23 02:03

timur