In this step, we will containerize the Spring Boot Backend and push the optimized Docker image to Amazon ECR.
For the Backend, we utilize a Multi-Stage Build strategy with eclipse-temurin:21 (Java 21). This ensures a small and secure final image.
appuser for security.

Run the build command in the backend project root. We tag the image as band-up-backend.
docker build -t band-up-backend .
Docker will execute the stages defined above.

We need a repository to store this image.
band-up-backend (Ensure this matches your push command).Private.Mutable.Once the image is built and the repository is ready, proceed to push.
Step 1: Tag the Image
Tag the local image with a version number (e.g., v1.0.0).
docker tag band-up-backend:latest [Account-ID].dkr.ecr.ap-southeast-1.amazonaws.com/band-up-backend:v1.0.0
Step 2: Push to ECR Upload the layers to AWS.
docker push [Account-ID].dkr.ecr.ap-southeast-1.amazonaws.com/band-up-backend:v1.0.0

Navigate to the Amazon ECR Console and select the bandup-backend repository. You should see the image tagged v1.0.0.
