Php 拉维尔黄昏与码头工人创作
我将Dock compose用于我的Laravel应用程序,docker-compose.yml文件如下所示Php 拉维尔黄昏与码头工人创作,php,laravel-5,docker-compose,Php,Laravel 5,Docker Compose,我将Dock compose用于我的Laravel应用程序,docker-compose.yml文件如下所示 version: '3' services: nginx: build: context: ./ dockerfile: docker/nginx.docker volumes: - ./apps/laravel/:/var/www - ./docker/nginx/ssl:/etc/nginx/ssl port
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
<?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'
}
}
php是这样的
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
<?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'
}
}
试试:
或