2

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

ありがとう。

4

1 に答える 1