Microservices
- A monolithic application is broken down into multiple individually runnable services. Each service should handle a functionality
- Each microservice change should be deployed seperately
- Containers are best to run individual microservices, Since there are lots of moving parts we need an orchestrator.
optimizations
- Optimizations refer to
- size: How to make docker images slim
- resources: min and max resources
- security: ensure docker image has no serious security issues
Activity 1:
- Take the multi stage docker image which we have used for spring petclinic
- Find out the size
Steps
- Create an ec2/vm
- create a spring petclinic image
- we need to scan this image for security issues
Things to Remember
- SBOM (Software Bill of Materials)
- Distroless images
- Scanners (Trivy)
Distroless spc
FROM maven:3-eclipse-temurin-21-alpine AS builder
COPY . /spc
WORKDIR /spc
RUN mvn package
FROM cgr.dev/chainguard/jre:latest
LABEL author=shaikkhajaibrahim
LABEL project=learning
LABEL version=3.3.0
USER nonroot
EXPOSE 8080
COPY --from=builder --chown=nonroot:nonroot /spc/target/spring-petclinic-4.0.0-SNAPSHOT.jar /app/spring-petclinic-4.0.0-SNAPSHOT.jar
WORKDIR /app
CMD ["java", "-jar", "spring-petclinic-4.0.0-SNAPSHOT.jar"]
-
After that scan and generate sbom and scan sbom.
-
Exercise: Do this for dotnet and react application
Like this:
Like Loading...