website icon indicating copy to clipboard operation
website copied to clipboard

✨ Enhancement: Refactor Dockerfile to Use Multi-Stage Build for Better Optimization

Open vivekrawat21 opened this issue 1 year ago • 13 comments

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

vivekrawat21 avatar Sep 20 '24 04:09 vivekrawat21

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.

github-actions[bot] avatar Sep 20 '24 04:09 github-actions[bot]

@iamAyushChamoli can this issue be assigned to me pls?

vidixha avatar Sep 22 '24 15:09 vidixha

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.

iamAyushChamoli avatar Sep 22 '24 15:09 iamAyushChamoli

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!

DhairyaMajmudar avatar Sep 22 '24 16:09 DhairyaMajmudar

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.

vivekrawat21 avatar Sep 22 '24 18:09 vivekrawat21

@benjagm can this issue be assigned to me pls?

vidixha avatar Sep 25 '24 07:09 vidixha

@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 avatar Sep 25 '24 14:09 benjagm

@benjagm

  • Enabling corepack within the dockerfile solves yarn version error.
  • Reduces docker build time.

vidixha avatar Sep 29 '24 16:09 vidixha

Thanks @AkshataABhat . Understood. Please go ahead with the changes.

benjagm avatar Sep 30 '24 17:09 benjagm

I've labeled this issue for hacktoberfest @AkshataABhat looking forward to have your PR, thank you : )

DhairyaMajmudar avatar Oct 02 '24 17:10 DhairyaMajmudar

@AkshataABhat any luck on this?

DhairyaMajmudar avatar Oct 24 '24 06:10 DhairyaMajmudar

@DhairyaMajmudar May I work on this issue!

techmannih avatar Oct 31 '24 11:10 techmannih

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:

github-actions[bot] avatar May 18 '25 02:05 github-actions[bot]

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.

github-actions[bot] avatar Nov 30 '25 02:11 github-actions[bot]