LoginSignup
0
1

More than 3 years have passed since last update.

docker環境でlaravel/Duskをインストール(laravel6)

Last updated at Posted at 2020-12-15

煮詰まっちゃったんで記事に残しておきます

前提条件

simotarooさんの絶対に失敗しないDockerでLaravel+Vueの実行環境(LEMP環境)を構築する方法、もしくはdockerにてlaravel,PHPの環境構築済みの方

環境

mac

docker (LEMP環境)

構築方法

任意のdockerfileに以下を追加しbuildし直す
※僕はsimotarooさんの記事を参考にして構築したためphpのdockerfileに記述しました

dockerfile
RUN apt-get -y install libzip-dev
RUN docker-php-ext-install zip


RUN apt-get -y install libnss3
RUN apt-get -y install libasound2-data  libasound2 xdg-utils
RUN apt install sudo
RUN apt-get install -y wget
RUN apt-get install -y gnupg2

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
RUN sudo apt update
RUN sudo apt-get install -y google-chrome-stable
RUN apt-get install -y fonts-ipafont 

.envのAPP_URLを書き換え

.env
APP_URL = http://localhost を

APP_URL=http://127.0.0.1:8000 に書き換え

tests/DuskTestCase.phpを書き換え

tests/DuskTestCase.php
    protected function driver()
    {
        $options = (new ChromeOptions)->addArguments([
            '--no-sandbox',
            '--disable-gpu',
            '--headless',
            '--window-size=1920,1080',
            '--lang=ja_JP',
        ]);

インストール後プロジェクト内で

composer require --dev laravel/dusk:
artisan dusk:install
php artisan serve

そんでテスト実行

php artisan dusk
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 11.2 seconds, Memory: 24.00 MB

OK (1 test, 1 assertion)

成功したら無事完成です

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1