-
Notifications
You must be signed in to change notification settings - Fork 65
Enhanced Docker security: Upgraded base image and dependencies #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: project
Are you sure you want to change the base?
Enhanced Docker security: Upgraded base image and dependencies #5
Conversation
WalkthroughThe Dockerfile has been updated for both the build and deployment stages. In the build stage, the Maven base image is upgraded and configured to cache dependencies locally. In the deployment stage, the base image is updated, system packages are refreshed to mitigate vulnerabilities, and a non-root user is created. Additional modifications include setting the working directory, adjusting the location of the JAR file, and enhancing the entrypoint command with a Java security option. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Build as Build Stage (Maven)
participant Deploy as Deployment Container
participant App as Application
Dev->>Build: Trigger Docker build using updated Maven image
Build->>Build: Compile and package application jar (with local Maven cache)
Build->>Deploy: Pass the packaged jar to deployment stage
note right of Deploy: Update system packages\nCreate non-root user (appuser)\nSet working directory to /app
Deploy->>App: Copy jar to /app/bankapp.jar and execute with security option
App-->>Deploy: Application running
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (11)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Hi Amitabh,
Thank you for your support with Trainwithcommunity and creating this awesome project repo. I've added another DevSecOps part to the Dockerfile using Trivy to scan the existing Dockerfile and fixing the Critical vulnerabilities
This PR addresses critical security vulnerabilities and fixes MySQL database connectivity issues in the Dockerized Spring Boot application.
Key Changes
✅ Updated Dockerfile
• Upgraded to eclipse-temurin:17-jre-alpine for better security.
• Added apk update && apk upgrade --no-cache to remove OS-level vulnerabilities.
• Ensured the application runs as a non-root user for security.
Screnshoot of the Dockerfile scan after the fix was applied!

I hope you'll find this fix meaningful and Merge this pull request I've created.
Thanks & Regards,
Anirban
Summary by CodeRabbit