As the DevOps engineer at a tech startup, you're preparing a todo management application for deployment. The application has grown complex, with a Java backend and a React frontend, each requiring its own build process. To ensure smooth and efficient deployments, your task is to streamline the Docker build process using multi-stage builds. By separating the stages for building, testing, and packaging, you'll create a reliable production-ready image that meets the company’s high standards for quality and performance.
You are tasked with refactoring the existing Dockerfile to use multi-stage builds for both the backend and frontend components. This will include setting up separate stages for building, testing, and packaging the application, ensuring that the final Docker image is optimized for production use.
The application is a todo management system consisting of a Java-based REST API backend and a React-based frontend. It utilizes environment variables for database connectivity and requires proper configuration to run successfully.
Important: The project’s README contains crucial information about the project structure, environment variables, and build steps. You must read the README carefully before starting this exercise. It provides detailed instructions on how to set up the environment, build the application, and run the backend and frontend services. Skipping this step may result in confusion or errors during the exercise.
DB_URL
, DB_USERNAME
, DB_PASSWORD
) for database connectivity.Refer to the README for detailed instructions on all of the above.
MULTI-STAGE-BUILD
branch for this exercise.8080
.eclipse-temurin:21-jre-alpine
for the backend and for serving the frontend.