Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Creating Multi-Stage Docker Builds for Laravel
Aug 17, 2018 @ 15:24:24

On the Laravel News site they've posted a tutorial showing you how to create multi-stage Docker builds for Laravel applications with a feature included in Docker 17.05.

Starting in Docker version 17.05 multi-stage builds are available to help you optimize Dockerfiles. Using multi-stage builds is a clean way to set up a Docker build pipeline that simplifies the requirements you need on your CI/build server to create a Docker image for your app.

If you’re not familiar with multi-stage builds, no worries! Let me summarize by saying that before multi-stage builds if you wanted to install composer dependencies and frontend dependencies during a docker build of your app, your Docker image would need to have the necessary dependencies such as Node.js installed and Composer PHP.

[...] By using multi-stage builds, you no longer need to install those dependencies or cram them all into your Dockerfile, thus bloating your final image size!

The tutorial then walks you through the multi-stage build approach using a new "demo" Laravel application as the base. In their example they show how to create the application, add it to a Git repository and set up the environment configurations. Next it includes the Dockerfiles required to create the different stages: installing Composer dependencies, installing Node dependencies and copying the application files and artifacts in to place.

tagged: tutorial laravel multistage docker build dependency

Link: https://laravel-news.com/multi-stage-docker-builds-for-laravel


Trending Topics: