I'm working on setting up a script in my
.gitlab-ci.yml file so that I'm able to deploy a newly built Docker image to my server.
Here is how it looks so far:
- ssh email@example.com '/bin/sh -c "cd /home/project/some/directory && export PATH=/bin:/usr/bin:/usr/local/bin && \ docker-compose stop web && \ docker-compose rm -f web && \ docker-compose up -d web && \ docker-compose exec web php artisan storage:link && \ exit"'
However, I keep getting "docker-compose: command not found" when running the command. Of course, docker-compose is install and available for the user 'deploy' when I log in with the user.
I found during my researches that it was because SSH doesn't load
usr/local/bin by default. I tried to solve this issue by enabling the user's profile in the
/etc/ssh/sshd_config file, and to export the PATH when running the script.
I'm running out of ideas on what I should try next.
What should I do?
Any idea welcome