Use Docker multistage building to package the application
Closed this issue · 0 comments
damien-carcel commented
- For back-end:
- Create a Dockerfile at the root of the back-end directory
- Create
dev
image containing the currentcarcel/skeleton/php
Dockerfile, - Use the
dev
image as a base for abuilder
intermediate image in which we install production dependencies and prepare the production cache - Create
fpm
images with the current FPM image, but remove volumes and copy the application in it from thebuilder
image, and create annginx
image the same way - Keep only dev images in Docker Compose and build all images using Docker with experimental
buildkit
feature - Control the whole build process through a Makefile at the root of the application (use
$(CURDIR)
to go in back or front directory)
- For the front-end:
- Keep the current
node
image for dev - Use it as a base image to build the front-end with webpack
- Copy the result in an
nginx
image - Use same workflow (Makefile and Docker
buildkit
) than for the back-end images
- Keep the current