我正在开发一个PHP Symfony项目,并使用GitLab。我想在GitLab上构建单元测试,为此我使用gitlab-ci.yml文件:
image: php:5.6
# Select what we should cache
cache:
paths:
- vendor/
before_script:
# Install git, the php image doesn't have installed
- apt-get update -yqq
- apt-get install git -yqq
# Install mysql driver
- docker-php-ext-install pdo_mysql
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- php composer.phar install
services:
- mysql
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: hello_world_test
MYSQL_ROOT_PASSWORD: mysql
# We test PHP5.5 (the default) with MySQL
test:mysql:
script:
- phpunit --configuration phpunit_mysql.xml --coverage-text -c app/
目前它无法工作,因为我的主机名在docker容器中没有解析。
我在这里找到了解决方案:如何让docker容器使用主机的/etc/hosts文件?
我的问题是:我在哪里写--net=host选项?
谢谢。
gitlab-ci.yml
中指定--net=host
吗? - Guillaume