Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Giuliano1993's avatar

Adding python to Laravel Sail set

Hello everyone, I wanted to know if someone knows any best practice to add python to a containerized Laravel application. Since we have the Dockerfiles in the vendor folder, that means that we can't edit them ( we can, but on deploy we would lose our changes and need to edit again the vendor dockerfile) So if i want to build a laravel application with sail, but need. a python script to run, how shoul i do? Thanks in advance

0 likes
11 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Do you need to run the python script from php? Or is it completely separate ?

To get the docker-compose file exposed run php artisan sail:install. This will copy it into your project

Also you should write a separate docker file for production. Sail should not be used for production. Its dev only

1 like
Giuliano1993's avatar

@Sinnbeck i have to execute it from php. Perfect, thanks also for the tip on sail, I'm pretty new to Laravel and Docker, I'm making some experiments with both but still learning

1 like
Sinnbeck's avatar

@Giuliano1993 Then I would install python inside the php container as it will need to run in on the CLI :)

1 like
Giuliano1993's avatar

@Sinnbeck Thank you so much. It was actually the first thing i tried, but i actually did it the wrong way. I'm feeling pretty stupid right now XD Thanks again for your help and time

markbalilo's avatar

@sinnbeck Goodafternoon Sir. May I ask on how to install python inside the php container using lando?

Sinnbeck's avatar

@markbalilo happy to help. It's untested so might need some tweaks, but I think it's close at least

Please or to participate in this conversation.