Laravel, add cache clearing and migration

jorgt
PRO

3 months ago

Hi,

I'm trying to set up laravel. while the deployment with the default nixpack works perfectly, I cannot seem to find the right place to clear and optimize caches and run any migration where applicable. I have followed these steps:

https://docs.railway.com/guides/laravel

in all place I try, php is not available. I have added some simple php artisan commands to the start step, deploy step and predeploy step. What's the correct way to do this?

Here's some of the output. While using the .sh file as described above in the build step. I have tried these as a script and by themselves:

[11/12] RUN  chmod +x ./build-app.sh && sh ./build-app.sh 
process "/bin/bash -ol pipefail -c chmod +x ./build-app.sh && sh ./build-app.sh" did not complete successfully: exit code: 1
 

Dockerfile:25

-------------------

23 |     # build phase

24 |     COPY . /app/.

25 | >>> RUN  chmod +x ./build-app.sh && sh ./build-app.sh

26 |

27 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c chmod +x ./build-app.sh && sh ./build-app.sh" did not complete successfully: exit code: 1

Error: Docker build failed

Here is the same command in the deploy stage.

Starting Container

 

   INFO  Nothing to migrate.  

 

/bin/bash: line 1:  php: command not found

Stopping Container
Awaiting User Response

3 Replies

chandrika
EMPLOYEE

3 months ago

Hey, have you checked our guide on deploying a Laravel app https://docs.railway.com/guides/laravel


Status changed to Awaiting User Response railway[bot] 3 months ago


chandrika

Hey, have you checked our guide on deploying a Laravel app https://docs.railway.com/guides/laravel

jorgt
PRO

3 months ago

Hello, yes I have actually pasted that link in my question to show you that I did my due diligence. It's possible I overlooked something but I can't see what.


Status changed to Awaiting Railway Response railway[bot] 3 months ago


2 months ago

Perhaps you would want to start from the template then?

https://railway.com/new/template/fWEWWf


Status changed to Awaiting User Response railway[bot] 3 months ago