GitlabCi slow build with docker and mysql service

Viewed 1904

I´m using gitlab-ci-multirunner 9.3.0 and the GitLab Community Edition 9.3.5

When i´m running my php-unit test on my local virtual box environment, the total test (30) just need about:

Time: 5 minutes, Memory: 96.00MB

Running the same tests on my gitlab host, it needs a total of

Time: 41.68 minutes, Memory: 97.75MB

The tests require mysql and do a database create and fixture load on each test.

My DockerFile:

FROM tetraweb/php:5.6

# Install additional packages
RUN apt-get clean && apt-get -qq update
RUN apt-get -qq upgrade -y
RUN apt-get install -qq -y apt-utils
RUN apt-get install -qq -y mysql-client libmagickwand-dev libgeoip-dev -y --no-install-recommends
RUN pecl install imagick apcu-4.0.11 geoip
RUN docker-php-ext-enable exif gd gettext intl mcrypt mysql mysqli opcache pdo_mysql zip memcache apcu imagick geoi

my gitlab-ci.yml:

variables:
  TIMEZONE: Europe/Berlin
  MYSQL_DATABASE: test
  MYSQL_ROOT_PASSWORD: test-root
  MYSQL_USER: test
  MYSQL_PASSWORD: asecurething
  SYMFONY_ENV: "test"

stages:
  - test
  - deploy

test:
  image: test-image-php:5.6
  services:
    - mariadb:latest
  stage: test
  only:
    - branches
  except:
    - master
  script:
      - export COMPOSER_CACHE_DIR=x/cache/composer
      - SYMFONY_ENV=test composer install --no-progress --no-interaction
      - chmod +x bin/console
      - php vendor/phpunit/phpunit/phpunit --coverage-text --colors=never

I really think thats the mysql service fault who creates the big difference. Whats the best way to increase the performance of my phpunit tests?

1 Answers
Related