damien-carcel/app-skeleton

Use Docker multistage building to package the application

Closed this issue · 0 comments

  • For back-end:
    • Create a Dockerfile at the root of the back-end directory
    • Create dev image containing the current carcel/skeleton/php Dockerfile,
    • Use the dev image as a base for a builder 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 the builder image, and create an nginx 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