php-laravel-docker icon indicating copy to clipboard operation
php-laravel-docker copied to clipboard

Updated example for Laravel 8 and PHP 8?

Open MeikyuuTrader opened this issue 3 years ago • 9 comments

Can this example get updated for Laravel 8 and PHP 8?

richarvey/nginx-php-fpm 2.0.0 supports PHP 8.1.

MeikyuuTrader avatar Feb 06 '22 03:02 MeikyuuTrader

Just tested deploying Laravel 8. Besides adding the different files (ones that aren't labelled as initial commit). Dockefile only needed to change nginx-fpm to 2.0.0. Eg.

FROM richarvey/nginx-php-fpm:2.0.0

Don't know how to submit pull requests so somebody please do that.

Also, I wonder if you could have a separate repo that only contains the necessary files to add to a default laravel install, like the Docker files, scripts etc. Instead of cloning a old Laravel package.

MeikyuuTrader avatar Feb 06 '22 04:02 MeikyuuTrader

So all we need to do to update our app to PHP 8 is to update the Dockerfile to nginx-php-fpm:2.0.0?

connor11528 avatar Mar 19 '22 13:03 connor11528

So all we need to do to update our app to PHP 8 is to update the Dockerfile to nginx-php-fpm:2.0.0?

Yeap, top line from Dockerfile. Not sure if it'll work with Laravel 5.8 though, I'm using Laravel 8, now Laravel 9

FROM richarvey/nginx-php-fpm:2.0.4

Considering this isn't updated, and is listed on the official render docs on getting Laravel setup, I'd suggest keeping the docker files, scripts and have a bit about setting up force https as the package instead. That way it can be copied into existing Laravel apps.

MeikyuuTrader avatar Mar 27 '22 04:03 MeikyuuTrader

Could you explain step by step how to do the implementation with Laravel 9?

forerof avatar Sep 18 '22 03:09 forerof

Could you explain step by step how to do the implementation with Laravel 9?

Follow official Laravel guide and install Laravel 9.

After installed, copy the conf/nginx folder and .dockerignore Dockerfile into your new Laravel 9 directory.

In Dockerfile, change the first line, FROM richarvey/nginx-php-fpm:1.9.1 to FROM richarvey/nginx-php-fpm:2.0.4. That 'should' work. Change the version 2.0.4 to whatever the latest nginx-php-fpm is.

MeikyuuTrader avatar Sep 27 '22 04:09 MeikyuuTrader

Thanks a lot

forerof avatar Sep 29 '22 00:09 forerof

@MeikyuuTrader, thanks for the info. That saved me some headache.

I, however, made a small change to ensure new updates sync:

FROM richarvey/nginx-php-fpm:latest

emmadonjo avatar Oct 31 '22 07:10 emmadonjo

How do I install npm packages? Can anyone help me with this?

anuzpandey avatar Jun 19 '23 17:06 anuzpandey

How do I install npm packages? Can anyone help me with this?

As far as I've seen, you can add script files in the scripts folder to be executed.

lombervid avatar Jul 31 '23 00:07 lombervid