Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dancourse's avatar

Gitlab CI, Homestead & Docker

Hello Laravelians',

I'm trying to get Gitlab CI working for my Laravel 5.0 project but I'm a bit stuck! Anyone got an example Laravel gitlab-ci.yaml file they could share?

Here's one I'm trying but I'm a bit stuck, I think maybe I need to do something with with the image, however I keep just getting an error saying it doesn't know PHP?!

Thank you!

DanC

php -v
bash: line 27: php: command not found

Here's my script so far, I have tried some other docker images too, joostlaan/hhvm-laravel, dylanlindgren/docker-laravel-composer

image: centos7

before_script:
  - php -v
  - curl -s https://getcomposer.org/installer | php
  - cp ./config/pst.gitlab-ci.php ./config/pst.php
  - cp ./.env.gitlab-ci ./.env
  - php composer.phar install --prefer-dist --quiet
  - php composer.phar dump-autoload --quiet
  - php artisan key:generate
  - php artisan migrate --force
  - php artisan up

tests:
  script: "phpunit --stop-on-failure && behat -f progress --stop-on-failure"
0 likes
3 replies
Kryten's avatar
Kryten
Best Answer
Level 1

You mention docker in your title, but not in your post, so this may be a red herring, but...

If you're trying to run your tests in a docker container, does the docker image install the php5-cli package? I'm assuming that's what it's called in centos - I'm used to working with debian.

dancourse's avatar

You know, apparently after chatting with people here it turns

a) I did not understand docker, so I watched this, https://www.youtube.com/watch?v=pGYAg7TMmp0 b) I think you're right, the centos package does not install php by default, hence why it cannot see it

So you're marked as correct, but I hope people also read this for the YT video

Please or to participate in this conversation.