✨ Enhancement: Refactor Dockerfile to Use Multi-Stage Build for Better Optimization
Is your feature request related to a problem? Please describe
The current Dockerfile is functional but can be optimized further by implementing a multi-stage build. Multi-stage builds help reduce the final image size by only including necessary files and dependencies in the final image, which improves security and efficiency, especially for production deployments.
Describe the solution you'd like
Refactor the existing Dockerfile to use a multi-stage build that separates the build environment from the production environment. This will allow us to: Compile/build the project in a Node.js environment with all necessary dependencies. Copy only the compiled code and required files into a smaller, cleaner image for production use, thus reducing the final image size.
Describe alternatives you've considered
No response
Additional context
No response
Are you working on this?
Yes
Welcome to the JSON Schema Community. We are so excited you are here! Thanks a lot for reporting your first issue!! 🎉🎉 Please make sure to take a look at our contributors guide if you plan on opening a pull request. For more details, check out the README.md file.
@iamAyushChamoli can this issue be assigned to me pls?
Hey @AkshataABhat, pardon I'm not one of the maintainers of this repository. If you think you can solve an issue, you can start working on it directly instead of waiting to be assigned.
Hi @vivekrawat21 can you pls. show the current image size and image size to be optimized after creating multi-stage build with relevant screenshots, Thank you!
Hi @DhairyaMajmudar,
While trying to build the image using make install, I encountered an error regarding the Yarn version. To resolve this, I believe we need to enable Corepack in the Docker image as well.
@benjagm can this issue be assigned to me pls?
@benjagm can this issue be assigned to me pls?
What do we gain by implementing this change? I'd like to avoid adding more complexity to the docs.
@benjagm
- Enabling corepack within the dockerfile solves yarn version error.
- Reduces docker build time.
Thanks @AkshataABhat . Understood. Please go ahead with the changes.
I've labeled this issue for hacktoberfest @AkshataABhat looking forward to have your PR, thank you : )
@AkshataABhat any luck on this?
@DhairyaMajmudar May I work on this issue!
Hello! :wave:
This issue has been automatically marked as stale due to inactivity :sleeping:
It will be closed in 180 days if no further activity occurs. To keep it active, please add a comment with more details.
There can be many reasons why a specific issue has no activity. The most probable cause is a lack of time, not a lack of interest.
Let us figure out together how to push this issue forward. Connect with us through our slack channel : https://json-schema.org/slack
Thank you for your patience :heart:
This issue did not get any activity in the past 180 days and thus has been closed. Please check if the main branch has fixed it. Please, create a new issue if the issue is not fixed.