Question

How to deploy a Laravel App from local Laravel/Sail Docker Image?

Posted August 23, 2021 283 views
DockerLaravel

The Laravel/Sail Docker development environment works great on my local computer. However I can’t figure out how to push this to the server. I am use to git repositories and am new to docker.

After pushing my local image (sail-8.0/app) to docker hub, I have pulled it to a DO/Docker server. Running the image is creating lots of errors.

While I find lots of tutorials on how to create a Docker image, I am not finding much on deploying the image to a server. It seems like I need to create a database and change some settings specific to the server. Sail on my local computer has a database, redis, and mailhog container in addition to the app container. I can’t even find links saying this is a bad idea. The Laravel/Sail website does not talk about deployment to the server. Please point me to the correct reosurce/guide.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there @dmh,

I believe that Laravel Sail is only used for local development.

Once you are ready to deploy your application to production, you could do one of the following:

  • Use LaraSail (it is a different tool for server configuration) to set up your server and then as you mentioned via Git you could pull your project to the new server:

https://www.digitalocean.com/community/tools/larasail

  • If you do not want to deal with server configuration and maintenance, you could use the DigitalOcean App platform. That way all that you would need to do is to push your Laravel project to GitHub and the deployments would be automatic:

  • Alternatively, you could also create a Docker Image, push it to Docker Hub and deploy from there.

Let me know if you have any questions.
Regards,
Bobby