I have started a project based on Laravel 5.1. It is hosted at Gitlab and i want to use the Gitlab CI with this project ( https://gitlab.com/nasirkhan/laravel-5-starter ). My .gitlab-ci.yml setting is following. But the build is failing every time when it runs the command php artisan migrate:refresh, with the error,
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
image: tetraweb/php:5.6-cli
services:
- mysql
variables:
WITH_XDEBUG: "1"
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
COMPOSER_HOME: /cache/composer
stages:
- test
php-5.6:
type: test
image: tetraweb/php:5.6-cli
script:
- docker-php-ext-enable zip
- docker-php-ext-enable mbstring
- docker-php-ext-enable pdo_mysql
- php -v
- composer self-update
- composer install --no-progress --no-interaction
- cp .env.example .env
- sed -i.bak 's/DB_HOST=localhost/DB_HOST=mysql/g' .env
- php artisan key:generate
- php artisan migrate:refresh
- php artisan db:seed
- php vendor/bin/phpunit --colors --coverage-text
ping -c 3 mysqlcomes to mind. Then follow the trail.