Method 1 : MULTI STAGE BUILD
Method 2 : DOCKER LAYER Reference : https://docs.docker.com/build/guide/layers/
Method 3 : SCRATCH IMAGE Reference : https://hub.docker.com/_/scratch/
The multistage Dockerfile consists of two build stages, each optimized for a specific purpose.
- Use a Python base image to build the Flask backend.
- Copy the backend source code and install dependencies.
- Build the Flask application.
- Use a minimal Python base image for the final image.
- Copy the built backend from Stage 1.
- Expose the necessary port and start the Flask application.