@@ -29,16 +29,24 @@ echo "Ensuring services are running"
2929
3030docker-compose up -d
3131
32- if docker run -it --rm " registry.gitlab.com/grahamcampbell/php:$php -base" -r " \$ tries = 0; while (true) { try { \$ tries++; if (\$ tries > 30) { throw new RuntimeException('MySQL never became available'); } sleep(1); new PDO('mysql:host=docker.for.mac.localhost ;dbname=forge', 'root', '', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$ e) {} }" ; then
32+ if docker run --add-host=host.docker.internal:host-gateway - it --rm " registry.gitlab.com/grahamcampbell/php:$php -base" -r " \$ tries = 0; while (true) { try { \$ tries++; if (\$ tries > 30) { throw new RuntimeException('MySQL never became available'); } sleep(1); new PDO('mysql:host=host. docker.internal ;dbname=forge', 'root', '', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$ e) {} }" ; then
3333 echo " Running tests"
3434
35- if docker run -it -w /data -v ${PWD} :/data:delegated \
36- --user " www-data" --entrypoint vendor/bin/phpunit \
37- --env CI=1 --env DB_HOST=docker.for.mac.localhost --env DB_USERNAME=root \
38- --env DB_HOST=docker.for.mac.localhost --env DB_PORT=3306 \
39- --env DYNAMODB_ENDPOINT=docker.for.mac.localhost:8000 --env DYNAMODB_CACHE_TABLE=cache --env AWS_ACCESS_KEY_ID=dummy --env AWS_SECRET_ACCESS_KEY=dummy \
40- --env REDIS_HOST=docker.for.mac.localhost --env REDIS_PORT=6379 \
41- --env MEMCACHED_HOST=docker.for.mac.localhost --env MEMCACHED_PORT=11211 \
35+ if docker run -it -w /data -v ${PWD} :/data:delegated -u $( id -u ${USER} ) :$( id -g ${USER} ) \
36+ --entrypoint vendor/bin/phpunit \
37+ --add-host=host.docker.internal:host-gateway \
38+ --env CI=1 \
39+ --env DB_HOST=host.docker.internal \
40+ --env DB_PORT=3306 \
41+ --env DB_USERNAME=root \
42+ --env DYNAMODB_ENDPOINT=host.docker.internal:8000 \
43+ --env DYNAMODB_CACHE_TABLE=cache \
44+ --env AWS_ACCESS_KEY_ID=dummy \
45+ --env AWS_SECRET_ACCESS_KEY=dummy \
46+ --env REDIS_HOST=host.docker.internal \
47+ --env REDIS_PORT=6379 \
48+ --env MEMCACHED_HOST=host.docker.internal \
49+ --env MEMCACHED_PORT=11211 \
4250 --rm " registry.gitlab.com/grahamcampbell/php:$php -base" " $@ " ; then
4351 exit 0
4452 else
0 commit comments