Deploying Laravel Server to render

I am having trouble deploying to render using the instructions in this article https://render.com/docs/deploy-php-laravel-docker
this is because this image(richarvey/nginx-php-fpm:1.7.2) only supports up to PHP 7.4 and my Laravel 9 app requires at least PHP 8.1.

I would appreciate any help

You can update your scripts.

create a Dockerfile on your root path

FROM richarvey/nginx-php-fpm:latest 

COPY . .

# Image config
ENV SKIP_COMPOSER 1
ENV WEBROOT /var/www/html/public
ENV PHP_ERRORS_STDERR 1
ENV RUN_SCRIPTS 1
ENV REAL_IP_HEADER 1

# Laravel config
ENV APP_ENV staging
ENV APP_DEBUG true
ENV LOG_CHANNEL stderr

# Allow composer to run as root
ENV COMPOSER_ALLOW_SUPERUSER 1

CMD ["/start.sh"]

Also create a scripts/00-laravel-deploy.sh file

#!/usr/bin/env bash
echo "Running composer"
cp /etc/secrets/.env .env
composer global require hirak/prestissimo
composer install --no-dev --working-dir=/var/www/html

echo "Clearing caches..."
php artisan optimize:clear

echo "Caching config..."
php artisan config:cache

echo "Caching routes..."
php artisan route:cache

echo "Running migrations..."
php artisan migrate --force

echo "done deploying"
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.