我正在尝试为 Gitlab CI Runner 设置我自己的 mysql conf。我在文档中找到了如何设置我自己的 php.ini :
before_script:
- cp ci/php.ini /usr/local/etc/php/conf.d/test.ini
我没有找到有关如何设置 my.cnf 的信息,我尝试过:
before_script:
- cp ci/my.cnf /usr/local/etc/mysql/conf.d/my.cnf
但是 /usr/local/etc/mysql/ 在生成的环境中不存在。
这就是我的全部 gitlab.ci :
services:
- mysql:latest
variables:
# Configure mysql environment variables
WITH_XDEBUG: "1"
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: symfony
cache:
paths:
- vendor/
before_script:
# Install dependencies
- bash ci/docker_install.sh > /dev/null
- cp ci/php.ini /usr/local/etc/php/conf.d/test.ini
- cp ci/my.cnf /usr/local/etc/mysql/conf.d/my.cnf
- mv app/config/parameters.gitlab.yml app/config/parameters.yml
- mv app/config/config_test.gitlab.yml app/config/config_test.yml
- composer clear-cache
- composer install
- php bin/console doctrine:schema:update --force
- php bin/console doctrine:fixtures:load
test:
image: php:7.0
stage: test
script:
- echo "Running PHPUnit Tests"
- vendor/bin/phpunit --configuration phpunit.xml.dist --colors --debug --coverage-text
还有我的 docker_install.sh :
#!/bin/bash
# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0
set -xe
# Install git (the php image doesn't have it) which is required by composer
apt-get update -yqq
apt-get install git -yqq
apt-get install wget -yqq
apt-get install zip unzip -yqq
# Install composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# Install mysql driver
# Here you can install any other extension that you need
docker-php-ext-install pdo_mysql mbstring
谢谢。