render-examples / php-laravel-docker

Larvel 5.8 PHP Docker Deployment on Render
https://render.com
MIT License
69 stars 599 forks source link

Updated example for Laravel 8 and PHP 8? #26

Open MeikyuuTrader opened 2 years ago

MeikyuuTrader commented 2 years ago

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

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

MeikyuuTrader commented 2 years ago

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.

connor11528 commented 2 years ago

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?

MeikyuuTrader commented 2 years ago

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.

forerof commented 1 year ago

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

MeikyuuTrader commented 1 year ago

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.

forerof commented 1 year ago

Thanks a lot

emmadonjo commented 1 year ago

@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

anuzpandey commented 1 year ago

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

lombervid commented 11 months ago

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.