Open tripper54 opened 6 years ago
Trying to figure out how to use a circleci MySQL container with this example. Can someone please push me in the right direction.
this is how my config.yml looks like:
version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-node-browsers
environment:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: testing
MYSQL_USER: testing
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_PASSWORD: testing
- image: mysql:5.7
environment:
MYSQL_USER: testing
MYSQL_ALLOW_EMPTY_PASSWORD: true
working_directory: ~/laravel
steps:
- checkout
- run: sudo apt install -y libsqlite3-dev zlib1g-dev
- run: sudo docker-php-ext-install zip
- run: composer install -n --prefer-dist
# - run: composer install --dev --ignore-platform-reqs
# prepare the database
- run:
name: Create Mysql Database
command: mysql -h 127.0.0.1 -u root -e "create database testing;"
the build breaks at last step
#!/bin/bash -eo pipefail
mysql -h 127.0.0.1 -u root -e "create database testing;"
/bin/bash: mysql: command not found
Exited with code 127
from here I found out that I have to add an mysql client to the primary container
- run: checkout
- run: sudo apt install -y mysql-client
But now I am running into another error
$ php artisan migrate
In Connection.php line 647:
could not find driver (SQL: select * from information_schema.tables where table_schema = circle_test and table_name = migrations)
In Connector.php line 68:
could not find driver
Yes, please add and MyQSL example.
@ec-wagner this should fix it
- run: sudo docker-php-ext-install zip pdo pdo_mysql
@ec-wagner this should fix it
- run: sudo docker-php-ext-install zip pdo pdo_mysql
@ridaamirini Your comment helped me fix the same issue. Thank you
Hi there,
Thanks for putting this example together, it has been a great help!
It would be really cool if you could extend it to include a mysql container for the DB layer. I think an example that included a second mysql container would cover typical use cases a lot better.
Thanks!