I'm a semi-newb when it comes to CI/CD. I'm attempting to use our Jenkins instance to spin up a Laravel instance (with php,mysql,testing lib[Dusk],etc baked in). I can successfully do all the actions locally without jenkins, so I know my app works. I can also successfully spin up docker-compose in my jenkins instance (judging by the console output). However, after I successfully spin up via docker-compose (docker-compose up -d), I don't know how to then run the laravel commands within that container. For example, 'sh 'php artisan make:test UserTest'. However I'm getting 'php: command not found' How do I 'enter' the running instance?
Here is most of my jenkinsfile (I've tried running my php commands in the root dir too):
pipeline {
agent {
label 'docker'
}
environment {
APP_NAME='Laravel'
APP_ENV='local'
...etc
}
stages {
stage("docker & dc -v") {
steps {
sh 'docker --version'
sh 'docker-compose --version'
sh 'docker-compose up -d'
sh 'echo "test is coming....."'
dir('src') {
sh "pwd"
sh 'ls -la'
sh 'php artisan make:test UserTest'
}
}
}
