Mysql as a service on .gitlab-ci.yml

How can I configure mysql when using it as a service on one of my jobs on .gitlab-ci.yml? I know that the mysql docker image has some env variables which helps me set up the database, user and root user. But what if I need additional configuration on /etc/mysql/my.cnf? How would one go to set this configuration file?

Thanks in advance.

i really need to know this too…

i’ve even created my own image (base on a php image) and added some config to /etc/mysql/my.cnf, but the configuration isnt loaded into the mysql service for some reason

edit: well there goes a couple days of my life.

i found a solution: instead of modifying and build the php image, i needed to create my own mysql image that adds my config:

FROM bitnami/mysql:latest

COPY config/mysql.cnf /etc/mysql/conf.d/mysql.cnf

then in my gitlab-ci.yml, overrides the mysql service with my new image, eg:

job:
  stage: test
  services:
    - {name: 'thejacer87/mysql:testing', alias: 'mysql'}
  script:
    - ./vendor/bin/phpunit --colors=never

found here: https://stackoverflow.com/a/54034654/4531186