You can use docker file and google cloud run to deploy the laravel application.
- Google Cloud Run .
- DockerFile .
- Cloud SQL Cloud SQL
Laravel will be deployed on serverless Cloud Run using docker file and startup scripts.
- Run a local php server including all the dependencies for php version and composer.
- Add the Dockerfile to it.
FROM php:8.2-fpm-alpine #change the php version accordingly
RUN apk add --no-cache nginx supervisor wget #install other packages if require like pdo_psql
RUN mkdir -p /run/nginx #this creates a nginx folder
COPY docker/nginx.conf /etc/nginx/nginx.conf #it copies the nginx conf from docker folder as mentioned in repo.
RUN mkdir -p /app
COPY . /app
#this install the composer dependencies
RUN sh -c "wget http://getcomposer.org/composer.phar && chmod a+x composer.phar && mv composer.phar /usr/local/bin/composer"
RUN cd /app && \
/usr/local/bin/composer install --no-dev
#if it gives platform errors try running with flaf --ignore-platform-reqs
RUN chown -R www-data: /app
CMD sh /app/docker/startup.sh