Hi, I am using circleCI 2.0 with Laravel app.
I am trying to execute php artisan db:seed, but I need to create some database before.
Can you help me please what's wrong, because it says "mysql command not found" when it executes task (run old database)
version: 2
jobs:
build:
docker:
- image: circleci/php7.1
- image: circleci/mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD=true
MYSQL_ROOT_HOST="%"
MYSQL_USER=root
MYSQL_DATABASE=circle_test
working_directory: ~/laravel
steps:
- checkout
- run:
name: Install System Dependencies
command: |
apt-get update \
&& apt-get install -y wget
- run:
name: install dockerize
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && tar -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz -C /usr/local/bin && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
environment:
DOCKERIZE_VERSION: v0.3.0
- run:
name: Wait for db
command: dockerize -wait tcp://localhost:3306 -timeout 1m
- run: composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.json" }}
- composer-v1-
- run: composer install -n --prefer-dist
- save_cache:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- run:
name: Run old database
command: |
mysql -u root -e "CREATE DATABASE somedb;" \
&& mysql -u root -D somedb < somedb.sql
- run:
name: Run migrations
command: php artisan migrate --force
environment:
(... some db variables )
- run:
name: Run seeds
command: php artisan db:seed --force
environment:
(... some db variables )
- run:
name: Run tests
command: ./vendor/bin/phpunit -c phpunit.circle.xml