Laravel å ¬å¼ãµã¤ãã§ç´¹ä»ããã¦ããæ¹æ³ã§ Laravel Sail ãã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ãããã¨ã©ã¼ãçºçãã¦å¦çãä¸æããã®ã§ãã®è§£æ±ºæ¹æ³ã®åå¿é²
æ¤è¨¼ç°å¢
Windows10 Home Edition (version 21H2) VirtualBox 6.1.32 vagrant 2.2.19 # Docker Host OS ubuntu 20.04.3 LTS (Focal Fossa) Docker version 20.10.8, build 3967b7d docker-compose version 1.29.2, build 5becea4c
ã¤ã³ã¹ãã¼ã«
çºçããã¨ã©ã¼ã«ã¤ãã¦
ä¸è¨ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ããéä¸ã§ã¨ã©ã¼ãçºçãã¦ä¸æãã
$ curl -s https://laravel.build/example-app | bash
ã¨ã©ã¼ã¡ãã»ã¼ã¸
[ErrorException] file_get_contents(/opt/example-app/vendor/symfony/error-handler/Resources/bin/patch-type-declarations): Failed to open stream: No such file or directory
ã¤ã³ã¹ãã¼ã«ã¹ã¯ãªããã®ä¸ã§ laravel new
ã使ããã¦ãã¦ãããã§ã¨ã©ã¼ãçºçãã¦ãã
解決æ¹æ³
composer
ã使ã£ã¦ã¤ã³ã¹ãã¼ã«ãããã¨ã§è§£æ±ºãã
$ docker pull composer $ docker run --rm -it --volume $PWD:/app composer create-project laravel/laravel example-app $ cd example-app $ docker run --rm -it --volume $PWD:/app composer require laravel/sail --dev $ docker run --rm -it --volume $PWD:/app composer php artisan sail:install --devcontainer Which services would you like to install? [mysql]: [0] mysql [1] pgsql [2] mariadb [3] redis [4] memcached [5] meilisearch [6] minio [7] mailhog [8] selenium > 0
docker build
çºçããã¨ã©ã¼ã«ã¤ãã¦
ã¤ã³ã¹ãã¼ã«å®äºå¾ã ./vendor/bin/sail up
ã§ã³ã³ãããèµ·åãããã¨ããã¨ããä¸è¨ã¨ã©ã¼ãçºç
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true' E: Sub-process returned an error code
Docker ã¤ã¡ã¼ã¸ã®ãã«ãä¸ã«ã¨ã©ã¼ãçºçãã¦ãã
解決æ¹æ³
ããã©ã«ã㯠context
ã« ./vendor/laravel/sail/runtimes/8.1
ãæå®ããã¦ãã
./vendor/laravel/sail/runtimes/8.0
ã«å¤æ´ããã¨ããæ£å¸¸ã«ãã«ãããã
docker-compose.yml
ãå¤æ´
--- a/docker-compose.yml Sat May 14 18:28:33 2022 +++ b/docker-compose.yml Sat May 14 16:36:36 2022 @@ -3,11 +3,11 @@ services: laravel.test: build: - context: ./vendor/laravel/sail/runtimes/8.1 + context: ./vendor/laravel/sail/runtimes/8.0 dockerfile: Dockerfile args: WWWGROUP: '${WWWGROUP}' - image: sail-8.1/app + image: sail-8.0/app extra_hosts: - 'host.docker.internal:host-gateway' ports:
sail build
ã§åãã«ã
$ ./vendor/bin/sail build --no-cache
åä½ç¢ºèª
sail up
ã§èµ·å
$ ./vendor/bin/sail up -d
http://<docker-host-ip>/
ã web ãã©ã¦ã¶ã§ã¢ã¯ã»ã¹ãã¦ä»¥ä¸ã®ç»é¢ã表示ããããæå