When configuring an application, we should be able to define the target to work properly with multi-staged Dockerfile
https://docs.docker.com/develop/develop-images/multistage-build/
We can easily use the same Dockerfile for local environment and remote environments
We can use the same image for different applications
It improves the cache usability
Let's say we have a Laravel application and we want to have three apps:
The php-fpm app (contains the full application with php-fpm running)
The nginx app (contains only the public folder of the app with nginx running)
The worker app (contains the full application with php artisan worker:run command)
Without the multi-stage feature, we must have three Dockerfiles where we could only have one:
FROM php:fpm-alpine AS build
// Build the app
FROM build AS app
CMD ["php-fpm"]
FROM build AS worker
CMD ["php artisan worker:run"]
FROM nginx:latest AS nginx
COPY --from=build /var/www/html/public /var/www/html/public
The we could just define the target (app, worker and nginx)
Please authenticate to join the conversation.
β Done
π‘ Feature Request
Over 3 years ago

Martin PAUCOT
Get notified by email when there are changes.
β Done
π‘ Feature Request
Over 3 years ago

Martin PAUCOT
Get notified by email when there are changes.