weektodo icon indicating copy to clipboard operation
weektodo copied to clipboard

[Improve] Shrink docker image size

Open Soulter opened this issue 9 months ago • 0 comments

Hi, thank you for your great work on WeekToDo! While reviewing the Dockerfile, I noticed that it currently uses yarn serve to run the application inside the container. However, this approach has some drawbacks:

Large Image Size: Since yarn serve runs a development server, the final Docker image includes unnecessary dependencies and results in a larger size. Slow Startup Time: The container needs to start a Node.js process each time, making it slower to boot. Inefficient Static File Serving: The built-in development server is not optimized for production use, whereas Nginx provides better performance and caching mechanisms. Suggested Improvement: To optimize the Docker image, I suggest using a multi-stage build approach:

Use a Node.js container to install dependencies and build the static files. Use a lightweight Nginx container to serve the built static files efficiently.

I can work for this if you think this is good.

Soulter avatar Mar 19 '25 05:03 Soulter