Install laravel/Dusk in docker environment (laravel6)

I've boiled it down so I'll leave it in the article

Prerequisites

simotaroo's How to build Laravel + Vue execution environment (LEMP environment) with Docker that never fails, or those who have already built laravel, PHP environment with docker

environment

mac

docker (LEMP environment)

How to build

Add the following to any docker file and rebuild

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 

Rewrite APP_URL in .env

.env


APP_URL = http://localhost

APP_URL=http://127.0.0.1:Rewritten to 8000

Rewrite 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',
        ]);

In the project after installation

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

Then test execution

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)

If successful, it is completed successfully

Recommended Posts

Install laravel/Dusk in docker environment (laravel6)
Just install Laravel8 on docker in PHP8 environment
Docker × Laravel HTTPS (SSL) communication in local environment
Install yarn in docker image
Build Docker + Laravel PHP + Vue.js development environment in 5 minutes
Dramatically speed up slow bundle install in docker environment
Command memo to install xeyes in ubuntu docker environment
Install / run a standalone robot simulator in wsl2 / docker environment!
Laravel + Docker Laradock usage environment construction
Install CentOS Stream 8 in Hyper-V environment
Create Laravel environment with Docker (docker-compose)
Build docker + laravel environment with laradock
Check MySQL logs in Docker environment
Install lsb_release from the command line when lsb_release fails in docker environment
Install PHP7.4 to build CentOS7 Laravel environment
Alert slack with alert manager in Docker environment
WSL2 + Ubuntu 20.04 Install Vivado in LTS environment
[Docker] Use environment variables in Nginx conf
Laravel development environment construction with Docker (Mac)
Use docker in proxy environment on ubuntu 20.04.1
Environment construction with Docker (Ubuntu20.04) + Laravel + nginx
Edit Mysql with commands in Docker environment
Laravel + MySQL + phpMyadmin environment construction with Docker
Install ruby serial port in WSL environment
Show Better Errors in Rails + Docker environment
Install Docker and create Java runtime environment
Docker + Laravel + Codeception
Docker in LXD
I had to lower the PHP version in Docker + Composer + Laravel environment
Docker environment construction
Self-hosting with Docker of AuteMuteUs in Windows environment
Build a Laravel / Docker environment with VSCode devcontainer
(Basic authentication) environment variables in rails and Docker
How to install Titan2D (v4.2.0) in virtual environment
Support out of support in docker environment using centos6
[Beginner] Install java development tool in cloud9 development environment.
Solved DB connection and CORS problem when developing Laravel × Nuxt.js in Docker environment
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
Migration error after Activerecord association in Rails5 + Docker environment (2)
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
Points stuck when running vite + Nginx in Docker environment
Migration error after Activerecord association in Rails5 + Docker environment
Install Docker on Manjaro
How to install Docker
[Note] Build a Python3 environment with Docker in EC2
SSL in the local environment of Docker / Rails / puma
Install Rust in WSL2 Ubuntu environment and build WASM build environment
Make the strongest Laravel development environment (Docker) Japan time
Database environment construction with Docker in Spring boot (IntellJ)
Install Composer with Docker
Beginners install docker for mac and prepare php7.0 operating environment
Host specification when laravel php artisan serve in docker container
Setting the baseURL in the axios module of Docker environment Nuxt
Install docker and docker-compose on ubuntu in the shortest process
[Portfolio] Manage site with laravel APP implementation (Docker environment construction)
When [command not found: composer] is displayed when [composer install] is displayed in Laravel
Exit code 1 occurs when Rails is stopped in Docker environment
[Docker context] ~ How to access docker in remote environment from VScode ~
Configuration script for using docker in proxy environment on ubuntu 20.04.1
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO