I am using docke-compose for my Laravel application and my docker-compose.yml file look like this
version: '3'
services:
nginx:
build:
context: ./
dockerfile: docker/nginx.docker
volumes:
- ./apps/laravel/:/var/www
- ./docker/nginx/ssl:/etc/nginx/ssl
ports:
- "8087:443"
links:
- php-fpm
container_name: insystems-nginx
php-fpm:
build:
context: ./
dockerfile: docker/php-fpm.docker
args:
- UID=${UID}
volumes:
- ./apps/laravel/:/var/www
- ./docker/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
links:
- mysql
environment:
- "DB_PORT=3306"
- "DB_HOST=mysql"
- "PHP_IDE_CONFIG=serverName=localhost"
user: www-data
container_name: insystems-php-fpm
php-cli:
build:
context: ./
dockerfile: docker/php-cli.docker
args:
- UID=${UID}
volumes:
- ./apps/laravel/:/var/www
links:
- mysql
- selenium
environment:
- "DB_PORT=3306"
- "DB_HOST=mysql"
tty: true
user: www-data
container_name: insystems-php-cli
mysql:
image: mysql:5.7
volumes:
- ./storage/docker/mysql:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=secret"
- "MYSQL_USER=app"
- "MYSQL_PASSWORD=secret"
- "MYSQL_DATABASE=app"
ports:
- "33061:3306"
container_name: insystems-mysql
selenium:
image: selenium/standalone-chrome:3.0.1-fermium
And DuskTestCase.php look like this
<?php
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
public function setUp(): void
{
parent::setUp();
}
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
static::startChromeDriver();
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--no-sandbox',
'--window-size=1920,1080',
]);
return RemoteWebDriver::create(
'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
//->setCapability('acceptInsecureCerts', true) //@TODO for https test
);
}
protected function baseUrl()
{
//@TODO 'http://$_SERVER["REMOTE_ADDR"]:8087'
return 'http://localhost:8087'
}
}
When I try to return http://localhost:8087 from baseUrl(), I got error in my test case. But if return http://172.19.0.1:8087 (172.19.0.1 is $_SERVER["REMOTE_ADDR"]) is working fine.
The problem is I want to use localhost not $_SERVER["REMOTE_ADDR"] and knows why. Can you please give me advice what I need to make change to run my test case as localhost.
Thanks in advanced.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2qcTxbH
via IFTTT
Aucun commentaire:
Enregistrer un commentaire